
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
angular-es6
Advanced tools
Do you want to use ES6 with angular and webpack? Here is a simple project with everything what you need at the beginning.
npm install angular-es6
Here is multiple examples:
export default class NiceDirective {
static $inject = ['$http'];
constructor($http) {
this.template = '<div>{{computeName('NICE')}}</div>';
this.restrict = 'E';
this.scope = {
name: '=',
};
}
link(scope) {
scope.computeName = suffix => computeName(suffix);
}
computeName(suffix = '') {
const { $http } = this.$inject;
const { scope } = this.link.$inject;
return 'Mr.' + $scope.name + ' ' + suffix;
}
}
export default class MainController {
static $inject = [$scope, '$http'];
constructor($scope) {
$scope.doThis = () => this.doThis();
}
doThis() {
const { $http } = this.$inject;
...
}
}
It is safe to use this.$inject because this object is initialized immediately after the constructor. If you want to use $injected object in constructor you can use arguments or extend class Inject.
Object this.$inject is initialized after class constructor. If you want to use this.$inject in your constructor you need to extend Inject class.
In next example is called function doThis from the constructor. You can use this.$inject because this object was initialized by Inject constructor.
import { Inject } from 'angular-es6';
export default class MainController extends Inject {
static $inject = ['$http'];
constructor(...args) {
super(...args);
this.doThis();
}
doThis() {
const { $http } = this.$inject;
}
}
Each directory need to have file index.js with content like this:
import { load } from 'angular-es6';
load.directives(require.context('./', true, /.*\.js$/));
More examples you can find in the example directory.
Pull requests are welcome
npm run build
npm run dev
FAQs
Angular ES6 utility library. Write directives, controllers and services as ES6 classes.
The npm package angular-es6 receives a total of 89 weekly downloads. As such, angular-es6 popularity was classified as not popular.
We found that angular-es6 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.