All Projects β†’ DAB0mB β†’ angular-ecmascript

DAB0mB / angular-ecmascript

Licence: other
Build an AngularJS app using ES6's class system

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to angular-ecmascript

Ng6 Starter
πŸ†– An AngularJS Starter repo for AngularJS + ES6 + Webpack
Stars: ✭ 1,933 (+6803.57%)
Mutual labels:  angularjs, angular1
pillow-cli
A CLI tool for booting modernized AngularJS projects.
Stars: ✭ 12 (-57.14%)
Mutual labels:  angularjs, angular1
angular-openweather-app
A weather forecast app written in AngularJS
Stars: ✭ 54 (+92.86%)
Mutual labels:  angularjs, angular1
AngularJS-ES6
No description or website provided.
Stars: ✭ 25 (-10.71%)
Mutual labels:  angularjs, angular1
ng-loader
Webpack loader for AngularJs components
Stars: ✭ 28 (+0%)
Mutual labels:  angularjs
uchiwa-web
Uchiwa is a simple yet effective open-source dashboard for the Sensu monitoring framework.
Stars: ✭ 17 (-39.29%)
Mutual labels:  angularjs
asana-webhooks-manager
Asana Webhooks Manager (AWM) is a free and open source management and event handling server, written in JavaScript (NodeJS, Angular) for Asana's webhooks API. Use AWM to manage webhooks subscriptions and accept event payloads from Asana in real-time. Want to create your own Asana Dashboard? Consider AWM as your starting point!
Stars: ✭ 23 (-17.86%)
Mutual labels:  angularjs
toxic-decorators
Library of Javascript decorators
Stars: ✭ 26 (-7.14%)
Mutual labels:  class
ng-caret-aware
AngularJS directive for caret aware elements
Stars: ✭ 12 (-57.14%)
Mutual labels:  angularjs
angular-easy-social-share
An easy way way to share the current page on an AngularJS app with Twitter, Facebook and LinkedIn.
Stars: ✭ 32 (+14.29%)
Mutual labels:  angularjs
ionic4-angular6-crud-example
Building CRUD Mobile App using Ionic 4, Angular 6 and Cordova
Stars: ✭ 50 (+78.57%)
Mutual labels:  angularjs
Swastika-IO-Admin
βœ” [ SIOA ] Swastika I/O Admin dashboard template based on Bootstrap 4
Stars: ✭ 18 (-35.71%)
Mutual labels:  angularjs
PHP-Light-SQL-Parser
This class can parse SQL to get query type, tables, field values, etc.. It takes an string with a SQL statements and parses it to extract its different components. Currently the class can extract the SQL query method, the names of the tables involved in the query and the field values that are passed as parameters. This parser is pretty light re…
Stars: ✭ 23 (-17.86%)
Mutual labels:  class
wp-testing
WordPress testing plugin
Stars: ✭ 12 (-57.14%)
Mutual labels:  angularjs
TravelWebApplication-Virtugo
This project is to develop a travel planner system, which describes about the climatic conditions, interesting places to visit, top hotels in the area and some additional features like travel reminders depending on the user’s destination. We have used Angular JS, HTML 5 for front end and Spring boot, MySQL for backend.
Stars: ✭ 21 (-25%)
Mutual labels:  angularjs
tubular
A set of AngularJS directives designed to rapidly build modern web applications
Stars: ✭ 44 (+57.14%)
Mutual labels:  angularjs
angular-environment
AngularJS Environment Plugin
Stars: ✭ 78 (+178.57%)
Mutual labels:  angularjs
BashClass
BashClass is an Object Oriented Programming language that compiles to BASH 4.4
Stars: ✭ 40 (+42.86%)
Mutual labels:  class
WebStore-Spring-MVC
WebStore is a full fledged online shopping system built in Spring-MVC. It uses JSP for view templating and MySql at the database end.
Stars: ✭ 29 (+3.57%)
Mutual labels:  angularjs
design-system
The official LumApps Design System (LumX) for AngularJS and React applications
Stars: ✭ 19 (-32.14%)
Mutual labels:  angularjs

Angular-Ecmascript

angular-ecmascript is a utility library which will help you write an AngularJS app using ES6's class system. As for now there is no official way to do so, however using ES6 syntax is recommended, hence this library was created.

In addition, angular-ecmascript provides us with some very handy features, like auto-injection without using any pre-processors like ng-annotate. For more information about angular-ecmascript's API and features please read the following docs.

Docs

angular-ecmascript provides us with some base module-helpers classes which we should inherit from while writing our helpers. These are the available helpers:

Each helper can be defined with a static $inject property which will be responsible for dependencies injection, and a static $name property, which is responsible for specifying the helper's name and defaults to the class'es name.

import { Service, Controller } from 'angular-ecmascript/module-helpers';

class DateService extends Service {
  static $name = '$date'

  now() {
    return new Date().getTime();
  }
}

class MyController extends Controller {
  static $inject = ['$date']

  constructor(...args) {
    super(...args);

    this.createdAt = this.$date.now();
  }
}

To interface with these helpers we will need to use a module-loader provided by angular-ecmascript. Just create a new AngularJS module wrapped by the loader and use it like so:

// libs
import Angular from 'angular';
import Loader from 'angular-ecmascript/module-loader';
// module-helpers
import MyCtrl from './controllers/my.ctrl';
import MyDirective from './directives/my.directive';
import MyService from './services/my.service';

// app
App = Angular.module('my-app', [
  'module1',
  'module2',
  'module3'
]);

// loader
new Loader(App)
  .load(MyCtrl)
  .load(MyDirective)
  .load(MyService);
  • Loader() can take a module name as the first argument and an optional dependencies array if you'd like to load a module by name.
  • Loader.load() can take an array of several module-helpers instead of chaining them one-by-one.
  • Loader.load() can take a string as the first argument representing the provider type and its value as the second argument, just like the $provide service.

Provider

Used to define a new provider.

import { Provider } from 'angular-ecmascript/module-helpers';

class MomentProvider extends Provider {
  static $name = '$now'

  $get() {
    return new Date().getTime();
  }
}

Service

Used to define a new service.

import { Service } from 'angular-ecmascript/module-helpers';

class DateService extends Service {
  static $name = '$date'

  now() {
    return new Date().getTime();
  }
}

Factory

Used to define a new factory.

  • Note that the create method must be implemented, otherwise an error will be thrown during load time.
import { Factory } from 'angular-ecmascript/module-helpers';

class MomentFactory extends Factory {
  static $name = 'now'

  create() {
    return new Date().getTime();
  }
}

Controller

Used to define a new controller.

  • $scope will be injected automatically so no need to specify it.
  • When using angular-meteor the controller will be set as the view model automatically.
import { Controller } from 'angular-ecmascript/module-helpers';

class MyController extends Controller {
  constructor(...args) {
    super(...args);

    this.createdAt = new Date().getTime();
  }

  logCreationTime() {
    console.log(`created at: ${this.createdAy}`);
  }
}

Directive

Used to define a new directive.

import { Directive } from 'angular-ecmascript/module-helpers';

class MyDirective extends Directive {
  templateUrl: 'my-template.html'
  restrict = 'E'
  transclude = true
  scope = {}

  link(scope) {
    scope.foo = 'foo';
    scope.bar = 'bar';
  }
}

Decorator

Used to define a new decorator.

  • $delegate will be injected automatically so no need to specify it.
  • Note that the decorate method must be implemented, otherwise an error will be thrown during load time.
  • No need to return the $delegate object, it should be handled automatically.
import { Decorator } from 'angular-ecmascript/module-helpers';

class MyDecorator extends Decorator {
  static $name = 'myService'

  helperFn() {
    // an additional fn to add to the service
  }

  decorate() {
    this.$delegate.aHelpfulAddition = this.helperFn;
  }
}

Filter

Used to define a new filter.

  • Note that the filter method must be implemented, otherwise an error will be thrown during load time.
import { Filter } from 'angular-ecmascript/module-helpers';

class MyFilter extends Filter {
  filter(input = '', uppercase) {
    let out = '';

    for (let i = 0; i < input.length; i++) {
      out = input.charAt(i) + out;
    }

    // conditional based on optional argument
    if (uppercase) {
      out = out.toUpperCase();
    }

    return out;
  }
}

Config

Used to define a new config.

  • Note that the configure method must be implemented, otherwise an error will be thrown during load time.
import { Config } from 'angular-ecmascript/module-helpers';

class RoutesCfg extends Config {
  static $inject = ['$routeProvider']

  constructor(...args) {
    super(...args);

    this.fetchUser = ['http', this::this.fetchUser];
  }

  configure() {
    this.$routeProvider
      .when('/', {
        template: '<home user="$resolve.user"></home>',
        resolve: {
          user: this.fetchUser
        }
      });
  }

  fetchUser($http) {
    return $http.get('...');
  }
}

Runner

Used to define a new run block.

  • Note that the run method must be implemented, otherwise an error will be thrown during load time.
import { Runner } from 'angular-meteor/module-helpers';

class RoutesRunner extends Runner {
  static $inject = ['$rootScope', '$state']

  run() {
    this.$rootScope.$on('$stateChangeError', (...args) => {
      const [,,, err] = args;

      if (err === 'AUTH_REQUIRED') {
        this.$state.go('login');
      }
    });
  }
}

Download

The source is available for download from GitHub. Alternatively, you can install using Node Package Manager (npm):

npm install angular-ecmascript
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].