Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-es6

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-es6 - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

2

package.json
{
"name": "angular-es6",
"description": "ECMAScript 6 boilerplate for angular source code and webpack",
"version": "2.0.3",
"version": "2.0.4",
"private": false,

@@ -6,0 +6,0 @@ "author": {

@@ -40,3 +40,3 @@ # Angular ECMAScript 6 config and boilerplate

this.scope = scope;
scope.computeName = suffix => computeName(suffix);
scope.computeName = (suffix) => this.computeName(suffix);
}

@@ -47,3 +47,3 @@

return 'Mr.' + $scope.name + ' ' + suffix;
return 'Mr.' + scope.name + ' ' + suffix;
}

@@ -59,3 +59,3 @@ }

export default class MainController {
static $inject = [$scope, '$http'];
static $inject = ['$scope', '$http'];

@@ -78,4 +78,4 @@ constructor($scope, $http) {

As you can see in the examples below. You need to store injected objects somehow.
There is a better solution. You can extend you class with class Inject and use variable named this.$inject.
As you can see in the examples above. You need to store injected objects somehow.
There is a better solution. You can extend you class with class named Inject and then you can use variable named this.$inject.

@@ -106,3 +106,35 @@ In next example is called function doThis from the constructor.

### Directive auto Inject
You can use variables from the link function anywhere in your directive code.
This feature is available without extending Inject class. Here is small example
```js
export default class NiceDirective {
static $inject = ['$http'];
constructor($http) {
this.$http = $http;
this.template = '<div>{{computeName('NICE')}}</div>';
this.restrict = 'E';
this.scope = {
name: '=',
};
}
link(scope) {
scope.computeName = (suffix) => this.computeName(suffix);
}
computeName(suffix = '') {
const { scope, element } = this.link.$inject;
element.text('Mr.' + scope.name + ' ' + suffix);
}
}
```
### Auto load directives

@@ -114,4 +146,6 @@

import { load } from 'angular-es6';
const MODULE_NAME = 'directives';
load.directives(require.context('./', true, /.*\.js$/));
export default MODULE_NAME;
```

@@ -118,0 +152,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc