Adapter to use Angular components and code inside an Aurelia project.
- Install the plugin into your project using npm
npm install angular-aurelia-adapter
- (Only when using Aurelia CLI) Add the NPM module as dependency to
aurelia.json
.
{
"name": "angular-aurelia-adapter",
"path": "../node_modules/angular-aurelia-adapter/dist",
"main": "index"
}
- Import the plugin using the
aurelia
configuration object
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
// Install the plugin
.plugin('angular-aurelia-adapter');
aurelia.start().then(_ => _.setRoot());
}
Since the plugin is globalized, you can use it by placing a <angularjs>
custom element in any of your views:
<angularjs modules.bind="HelloWorld.id" controller.bind="HelloWorld.controller">
<hello-world value="$ctrl.value"></hello-world>
</angularjs>
import {AngularJSCompiler} from "angular-aurelia-adapter";
AngularJSCompiler
.create(["yourModuleIDs"])
.compile(this.elementToCompile, this.myController);
import {AngularJSCompiler} from "angular-aurelia-adapter";
AngularJSCompiler
.create(["yourModuleIDs"])
.invoke(($location, $timeout) => {
$timeout(_ => {
$location.path("/newValue");
}, 1000);
});