@cerebral/angularjs
Advanced tools
Comparing version 4.0.0-1526409797341 to 4.0.0-1527015081471
@@ -139,3 +139,3 @@ 'use strict'; | ||
controller: controller | ||
app: controller | ||
}; | ||
@@ -142,0 +142,0 @@ }]; |
{ | ||
"name": "@cerebral/angularjs", | ||
"version": "4.0.0-1526409797341", | ||
"version": "4.0.0-1527015081471", | ||
"description": "Angularjs view for Cerebral", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"cerebral": "^5.0.0-1526409797341" | ||
"cerebral": "^5.0.0-1527015081471" | ||
}, | ||
@@ -20,0 +20,0 @@ "scripts": { |
@@ -13,23 +13,22 @@ # @cerebral/angularjs | ||
import angular from 'angular' | ||
import {addModule, connect} from '@cerebral/angularjs' | ||
import {Controller} from 'cerebral' | ||
import {state, signal} from 'cerebral/tags' | ||
import { addModule, connect } from '@cerebral/angularjs' | ||
import App from 'cerebral' | ||
addModule(angular) | ||
const rootModule = Module({ | ||
const mainModule = Module({ | ||
state: { | ||
foo: 'bar' | ||
}, | ||
signals: { | ||
clicked: [] | ||
sequences: { | ||
onClick: [] | ||
}, | ||
services: ['MyAngularService'] // Root module only. Added as providers with same name | ||
services: ['MyAngularService'] // main module only. Added as providers with same name | ||
}) | ||
const controller = Controller() | ||
const app = App(mainModule) | ||
angular.module('app', ['cerebral']) | ||
.config(function (cerebralProvider) { | ||
cerebralProvider.configure(controller) | ||
cerebralProvider.configure(app) | ||
}) | ||
@@ -43,4 +42,4 @@ ... | ||
import angular from 'angular' | ||
import {addModule, connect} from '@cerebral/angularjs' | ||
import {state, signal} from 'cerebral/tags' | ||
import { addModule, connect } from '@cerebral/angularjs' | ||
import { state, sequences } from 'cerebral/tags' | ||
@@ -52,12 +51,12 @@ angular.module('app', ['cerebral']) | ||
controller: connect({ | ||
foo: state`foo`, | ||
click: signal`clicked` | ||
foo: state.foo, | ||
click: sequences.onClick | ||
}, 'MyComponent', ['cerebral', function MyController (cerebral) { | ||
// In some cases you might need access to cerebral's controller. | ||
// In some cases you might need access to the cerebral app. | ||
// You can inject the cerebral angular service and | ||
// access it's controller property anywhere in your app | ||
cerebral.controller.getSignal('mySignal')() | ||
// access it's app property anywhere in your app | ||
cerebral.app.getSequence('mySignal')() | ||
// Optionally add custom behaviour to controller | ||
// Optionally add custom behaviour to app | ||
}]) | ||
@@ -64,0 +63,0 @@ }) |
Sorry, the diff of this file is not supported yet
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
19243
75