@cerebral/angularjs
Advanced tools
Comparing version 1.0.0-1504950403186 to 1.0.0-1504962746906
{ | ||
"name": "@cerebral/angularjs", | ||
"version": "1.0.0-1504950403186", | ||
"version": "1.0.0-1504962746906", | ||
"description": "Angularjs view for Cerebral", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"cerebral": "^2.2.0-1504950403186" | ||
"cerebral": "^2.2.0-1504962746906" | ||
}, | ||
@@ -20,0 +20,0 @@ "scripts": { |
@@ -12,3 +12,4 @@ # @cerebral/angularjs | ||
import angular from 'angular' | ||
import {addModule} from '@cerebral/angularjs' | ||
import {addModule, connect} from '@cerebral/angularjs' | ||
import {state, signal} from 'cerebral/tags' | ||
@@ -23,2 +24,5 @@ addModule(angular) | ||
}, | ||
signals: { | ||
clicked: [] | ||
}, | ||
@@ -30,2 +34,3 @@ // Special controller property to expose core | ||
}) | ||
... | ||
``` | ||
@@ -36,21 +41,24 @@ | ||
import angular from 'angular' | ||
import {connect} from '@cerebral/angularjs' | ||
import {addModule, connect} from '@cerebral/angularjs' | ||
import {state, signal} from 'cerebral/tags' | ||
angular.component('myComponent', { | ||
template: '<div ng-click="click()">{{foo}}</div>', | ||
controller: connect({ | ||
foo: state`foo`, | ||
click: signal`clicked` | ||
}, 'MyComponent', ['cerebral', function MyController (cerebral) { | ||
angular.module('app', ['cerebral']) | ||
.config(...) | ||
.component('myComponent', { | ||
template: '<div ng-click="$ctrl.click()">{{$ctrl.foo}}</div>', | ||
controller: connect({ | ||
foo: state`foo`, | ||
click: signal`clicked` | ||
}, 'MyComponent', ['cerebral', function MyController (cerebral) { | ||
// In some cases you might need access to cerebral's controller. | ||
// You can inject the cerebral angular service and | ||
// access it's controller property anywhere in your app | ||
cerebral.controller.getSignal('mySignal')() | ||
// In some cases you might need access to cerebral's controller. | ||
// You can inject the cerebral angular service and | ||
// access it's controller property anywhere in your app | ||
cerebral.controller.getSignal('mySignal')() | ||
// Optionally add custom behaviour to controller | ||
}]) | ||
}) | ||
// Optionally add custom behaviour to controller | ||
}]) | ||
}) | ||
``` | ||
Since angular doesn't expose the component name, | ||
@@ -57,0 +65,0 @@ you will need to provide one to `connect` for the |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20765
71