forked from anuroopjoy/single-spa-legacy-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
57 lines (52 loc) · 1.34 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
System.register([], function (_export) {
return {
execute: function () {
_export(
window.singleSpaAngularjs.default({
angular: angular,
mainAngularModule: "main-module",
uiRouter: true,
preserveGlobal: false,
})
);
},
};
});
var app = angular.module("main-module", ["ui.router"]);
app.config(function ($stateProvider) {
$stateProvider.state({
name: "main",
url: "/home",
template: "<home />",
});
});
app.component("home", {
template: `First Name: <input type="text" ng-model="firstName" ng-change="vm.log()"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
Full Name: {{firstName + ' ' + lastName }}`,
controllerAs: "vm",
controller: function () {
var vm = this;
vm.$onInit = function () {
console.log("mounting angularjs component");
console.log(
"legacyAngularApp status",
singleSpa.getAppStatus("legacyAngularApp")
);
};
vm.$onDestroy = function () {
console.log(
"legacyAngularApp status",
singleSpa.getAppStatus("legacyAngularApp")
);
console.log("unmounting angularjs component!");
};
vm.log = function () {
console.log(
"legacyAngularApp status",
singleSpa.getAppStatus("legacyAngularApp")
);
};
},
});