@angular-wave/angular.ts 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/angular-ts.esm.js +1 -1
  2. package/dist/angular-ts.umd.js +1 -1
  3. package/package.json +1 -1
  4. package/src/exts/messages.md +30 -30
  5. package/src/index.js +0 -1
  6. package/src/router/adapter/directives/stateDirectives.js +17 -27
  7. package/src/router/adapter/directives/viewDirective.js +35 -45
  8. package/src/router/adapter/services.js +4 -3
  9. package/src/router/adapter/stateFilters.js +2 -7
  10. package/src/router/adapter/statebuilders/onEnterExitRetain.js +1 -2
  11. package/src/router/adapter/statebuilders/views.js +4 -5
  12. package/src/router/adapter/templateFactory.js +1 -1
  13. package/src/router/adapter/viewScroll.js +1 -8
  14. package/src/router/core/common/common.js +10 -22
  15. package/src/router/core/params/param.js +5 -5
  16. package/src/router/core/params/paramType.js +3 -3
  17. package/src/router/core/params/paramTypes.js +6 -7
  18. package/src/router/core/params/stateParams.js +3 -3
  19. package/src/router/core/path/pathNode.js +2 -2
  20. package/src/router/core/path/pathUtils.js +4 -5
  21. package/src/router/core/resolve/resolvable.js +2 -2
  22. package/src/router/core/state/stateBuilder.js +1 -2
  23. package/src/router/core/state/stateObject.js +3 -3
  24. package/src/router/core/state/stateService.js +2 -3
  25. package/src/router/core/state/targetState.js +8 -5
  26. package/src/router/core/transition/hookBuilder.js +2 -2
  27. package/src/router/core/transition/hookRegistry.js +2 -2
  28. package/src/router/core/transition/rejectFactory.js +2 -3
  29. package/src/router/core/transition/transition.js +5 -3
  30. package/src/router/core/url/urlMatcherFactory.js +2 -8
  31. package/src/router/core/url/urlRule.js +7 -4
  32. package/src/router/core/url/urlService.js +2 -2
  33. package/src/router/router.js +28 -10
  34. package/test/module-test.html +15 -12
  35. package/test/ng/directive/if.spec.js +0 -1
  36. package/test/original-test.html +27 -15
@@ -5,7 +5,6 @@ import {
5
5
  equals,
6
6
  inherit,
7
7
  map,
8
- extend,
9
8
  pick,
10
9
  } from "../common/common";
11
10
  import { isDefined, isNullOrUndefined } from "../common/predicates";
@@ -52,7 +51,7 @@ export class ParamTypes {
52
51
  ]);
53
52
  // Register default types. Store them in the prototype of this.types.
54
53
  const makeType = (definition, name) =>
55
- new ParamType(extend({ name }, definition));
54
+ new ParamType(Object.assign({ name }, definition));
56
55
  this.types = inherit(map(this.defaultTypes, makeType), {});
57
56
  }
58
57
  dispose() {
@@ -65,9 +64,9 @@ export class ParamTypes {
65
64
  */
66
65
  type(name, definition, definitionFn) {
67
66
  if (!isDefined(definition)) return this.types[name];
68
- if (this.types.hasOwnProperty(name))
67
+ if (Object.prototype.hasOwnProperty.call(this.types, name))
69
68
  throw new Error(`A type named '${name}' has already been defined.`);
70
- this.types[name] = new ParamType(extend({ name }, definition));
69
+ this.types[name] = new ParamType(Object.assign({ name }, definition));
71
70
  if (definitionFn) {
72
71
  this.typeQueue.push({ name, def: definitionFn });
73
72
  if (!this.enqueue) this._flushTypeQueue();
@@ -79,7 +78,7 @@ export class ParamTypes {
79
78
  const type = this.typeQueue.shift();
80
79
  if (type.pattern)
81
80
  throw new Error("You cannot override a type's .pattern at runtime.");
82
- extend(this.types[type.name], services.$injector.invoke(type.def));
81
+ Object.assign(this.types[type.name], services.$injector.invoke(type.def));
83
82
  }
84
83
  }
85
84
  }
@@ -94,10 +93,10 @@ function initDefaultTypes() {
94
93
  // tslint:disable-next-line:triple-equals
95
94
  equals: (a, b) => a == b, // allow coersion for null/undefined/""
96
95
  };
97
- return extend({}, defaultTypeBase, def);
96
+ return Object.assign({}, defaultTypeBase, def);
98
97
  };
99
98
  // Default Parameter Type Definitions
100
- extend(ParamTypes.prototype, {
99
+ Object.assign(ParamTypes.prototype, {
101
100
  string: makeDefaultType({}),
102
101
  path: makeDefaultType({
103
102
  pattern: /[^/]*/,
@@ -1,7 +1,7 @@
1
- import { extend, ancestors } from "../common/common";
1
+ import { ancestors } from "../common/common";
2
2
  export class StateParams {
3
3
  constructor(params = {}) {
4
- extend(this, params);
4
+ Object.assign(this, params);
5
5
  }
6
6
  /**
7
7
  * Merges a set of parameters with all parameters inherited between the common parents of the
@@ -30,6 +30,6 @@ export class StateParams {
30
30
  inherited[parentParamsKeys[j]] = this[parentParamsKeys[j]];
31
31
  }
32
32
  }
33
- return extend({}, inherited, newParams);
33
+ return Object.assign({}, inherited, newParams);
34
34
  }
35
35
  }
@@ -1,4 +1,4 @@
1
- import { extend, applyPairs, find } from "../common/common";
1
+ import { applyPairs, find } from "../common/common";
2
2
  import { propEq } from "../common/hof";
3
3
  import { Param } from "../params/param";
4
4
  /**
@@ -14,7 +14,7 @@ export class PathNode {
14
14
  const node = stateOrNode;
15
15
  this.state = node.state;
16
16
  this.paramSchema = node.paramSchema.slice();
17
- this.paramValues = extend({}, node.paramValues);
17
+ this.paramValues = Object.assign({}, node.paramValues);
18
18
  this.resolvables = node.resolvables.slice();
19
19
  this.views = node.views && node.views.slice();
20
20
  } else {
@@ -1,5 +1,4 @@
1
1
  import {
2
- extend,
3
2
  find,
4
3
  pick,
5
4
  omit,
@@ -76,7 +75,7 @@ export class PathUtils {
76
75
  static inheritParams(fromPath, toPath, toKeys = []) {
77
76
  function nodeParamVals(path, state) {
78
77
  const node = find(path, propEq("state", state));
79
- return extend({}, node && node.paramValues);
78
+ return Object.assign({}, node && node.paramValues);
80
79
  }
81
80
  const noInherit = fromPath
82
81
  .map((node) => node.paramSchema)
@@ -89,7 +88,7 @@ export class PathUtils {
89
88
  */
90
89
  function makeInheritedParamsNode(toNode) {
91
90
  // All param values for the node (may include default key/vals, when key was not found in toParams)
92
- let toParamVals = extend({}, toNode && toNode.paramValues);
91
+ let toParamVals = Object.assign({}, toNode && toNode.paramValues);
93
92
  // limited to only those keys found in toParams
94
93
  const incomingParamVals = pick(toParamVals, toKeys);
95
94
  toParamVals = omit(toParamVals, toKeys);
@@ -98,7 +97,7 @@ export class PathUtils {
98
97
  noInherit,
99
98
  );
100
99
  // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals
101
- const ownParamVals = extend(
100
+ const ownParamVals = Object.assign(
102
101
  toParamVals,
103
102
  fromParamVals,
104
103
  incomingParamVals,
@@ -196,4 +195,4 @@ PathUtils.nonDynamicParams = (node) =>
196
195
  node.state.parameters({ inherit: false }).filter((param) => !param.dynamic);
197
196
  /** Gets the raw parameter values from a path */
198
197
  PathUtils.paramValues = (path) =>
199
- path.reduce((acc, node) => extend(acc, node.paramValues), {});
198
+ path.reduce((acc, node) => Object.assign(acc, node.paramValues), {});
@@ -1,4 +1,4 @@
1
- import { extend, identity } from "../../../core/utils";
1
+ import { identity } from "../../../core/utils";
2
2
  import { services } from "../common/coreservices";
3
3
  import { trace } from "../common/trace";
4
4
  import { stringify } from "../common/strings";
@@ -26,7 +26,7 @@ export class Resolvable {
26
26
  this.resolved = false;
27
27
  this.promise = undefined;
28
28
  if (arg1 instanceof Resolvable) {
29
- extend(this, arg1);
29
+ Object.assign(this, arg1);
30
30
  } else if (isFunction(resolveFn)) {
31
31
  if (isNullOrUndefined(arg1))
32
32
  throw new Error("new Resolvable(): token argument is required");
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  applyPairs,
3
- extend,
4
3
  identity,
5
4
  inherit,
6
5
  mapObj,
@@ -89,7 +88,7 @@ function pathBuilder(state) {
89
88
  return state.parent ? state.parent.path.concat(state) : /*root*/ [state];
90
89
  }
91
90
  function includesBuilder(state) {
92
- const includes = state.parent ? extend({}, state.parent.includes) : {};
91
+ const includes = state.parent ? Object.assign({}, state.parent.includes) : {};
93
92
  includes[state.name] = true;
94
93
  return includes;
95
94
  }
@@ -1,4 +1,4 @@
1
- import { defaults, find, inherit } from "../common/common";
1
+ import { defaults, find } from "../common/common";
2
2
  import { propEq } from "../common/hof";
3
3
  import { Glob } from "../common/glob";
4
4
  import { isObject, isFunction } from "../common/predicates";
@@ -25,7 +25,7 @@ export class StateObject {
25
25
  stateDecl = StateObject.isStateClass(stateDecl)
26
26
  ? new stateDecl()
27
27
  : stateDecl;
28
- const state = inherit(inherit(stateDecl, StateObject.prototype));
28
+ const state = Object.setPrototypeOf(stateDecl, StateObject.prototype);
29
29
  stateDecl.$$state = () => state;
30
30
  state.self = stateDecl;
31
31
  state.__stateObjectCache = {
@@ -33,7 +33,7 @@ export class StateObject {
33
33
  };
34
34
  return state;
35
35
  }
36
- /** @deprecated use State.create() */
36
+ // /** @deprecated use State.create() */
37
37
  constructor(config) {
38
38
  return StateObject.create(config || {});
39
39
  }
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  createProxyFunctions,
3
3
  defaults,
4
- extend,
5
4
  inArray,
6
5
  noop,
7
6
  removeFrom,
@@ -338,7 +337,7 @@ export class StateService {
338
337
  const globals = router.globals;
339
338
  options = defaults(options, defaultTransOpts);
340
339
  const getCurrent = () => globals.transition;
341
- options = extend(options, { current: getCurrent });
340
+ options = Object.assign(options, { current: getCurrent });
342
341
  const ref = this.target(to, toParams, options);
343
342
  const currentPath = this.getCurrentPath();
344
343
  if (!ref.exists()) return this._handleInvalidTargetState(currentPath, ref);
@@ -391,7 +390,7 @@ export class StateService {
391
390
  .catch(rejectedTransitionHandler(transition));
392
391
  silenceUncaughtInPromise(transitionToPromise); // issue #2676
393
392
  // Return a promise for the transition, which also has the transition object on it.
394
- return extend(transitionToPromise, { transition });
393
+ return Object.assign(transitionToPromise, { transition });
395
394
  }
396
395
  /**
397
396
  * Checks if the current state *is* the provided state
@@ -1,6 +1,5 @@
1
1
  import { isObject, isString } from "../common/predicates";
2
2
  import { stringify } from "../common/strings";
3
- import { extend } from "../common/common";
4
3
  /**
5
4
  * Encapsulate the target (destination) state/params/options of a [[Transition]].
6
5
  *
@@ -49,8 +48,8 @@ export class TargetState {
49
48
  this._stateRegistry = _stateRegistry;
50
49
  this._identifier = _identifier;
51
50
  this._identifier = _identifier;
52
- this._params = extend({}, _params || {});
53
- this._options = extend({}, _options || {});
51
+ this._params = Object.assign({}, _params || {});
52
+ this._options = Object.assign({}, _options || {});
54
53
  this._definition = _stateRegistry.matcher.find(
55
54
  _identifier,
56
55
  this._options.relative,
@@ -124,7 +123,9 @@ export class TargetState {
124
123
  * When true the parameter values will be used instead of the current values.
125
124
  */
126
125
  withParams(params, replace = false) {
127
- const newParams = replace ? params : extend({}, this._params, params);
126
+ const newParams = replace
127
+ ? params
128
+ : Object.assign({}, this._params, params);
128
129
  return new TargetState(
129
130
  this._stateRegistry,
130
131
  this._identifier,
@@ -140,7 +141,9 @@ export class TargetState {
140
141
  * When true the options will be used instead of the current options.
141
142
  */
142
143
  withOptions(options, replace = false) {
143
- const newOpts = replace ? options : extend({}, this._options, options);
144
+ const newOpts = replace
145
+ ? options
146
+ : Object.assign({}, this._options, options);
144
147
  return new TargetState(
145
148
  this._stateRegistry,
146
149
  this._identifier,
@@ -1,4 +1,4 @@
1
- import { extend, assertPredicate, unnestR, identity } from "../common/common";
1
+ import { assertPredicate, unnestR, identity } from "../common/common";
2
2
  import { isArray } from "../common/predicates";
3
3
  import { TransitionHookPhase, TransitionHookScope } from "./interface";
4
4
  import { TransitionHook } from "./transitionHook";
@@ -57,7 +57,7 @@ export class HookBuilder {
57
57
  const matchingNodes = matches[hookType.criteriaMatchPath.name];
58
58
  // Return an array of HookTuples
59
59
  return matchingNodes.map((node) => {
60
- const _options = extend(
60
+ const _options = Object.assign(
61
61
  {
62
62
  bind: hook.bind,
63
63
  traceData: { hookType: hookType.name, context: node },
@@ -1,4 +1,4 @@
1
- import { extend, removeFrom, tail, identity, mapObj } from "../common/common";
1
+ import { removeFrom, tail, identity, mapObj } from "../common/common";
2
2
  import { isString, isFunction } from "../common/predicates";
3
3
  import { Glob } from "../common/glob";
4
4
  import {
@@ -114,7 +114,7 @@ export class RegisteredHook {
114
114
  * ```
115
115
  */
116
116
  _getMatchingNodes(treeChanges, transition) {
117
- const criteria = extend(
117
+ const criteria = Object.assign(
118
118
  this._getDefaultMatchCriteria(),
119
119
  this.matchCriteria,
120
120
  );
@@ -1,5 +1,4 @@
1
- "use strict";
2
- import { extend, silentRejection } from "../common/common";
1
+ import { silentRejection } from "../common/common";
3
2
  import { stringify } from "../common/strings";
4
3
  import { is } from "../common/hof";
5
4
  /** An enum for Transition Rejection reasons */
@@ -117,6 +116,6 @@ export class Rejection {
117
116
  return `Transition Rejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;
118
117
  }
119
118
  toPromise() {
120
- return extend(silentRejection(this), { _transitionRejection: this });
119
+ return Object.assign(silentRejection(this), { _transitionRejection: this });
121
120
  }
122
121
  }
@@ -4,7 +4,6 @@ import { stringify } from "../common/strings";
4
4
  import {
5
5
  map,
6
6
  find,
7
- extend,
8
7
  mergeR,
9
8
  tail,
10
9
  omit,
@@ -118,7 +117,10 @@ export class Transition {
118
117
  throw new Error(targetState.error());
119
118
  }
120
119
  // current() is assumed to come from targetState.options, but provide a naive implementation otherwise.
121
- this._options = extend({ current: val(this) }, targetState.options());
120
+ this._options = Object.assign(
121
+ { current: val(this) },
122
+ targetState.options(),
123
+ );
122
124
  this.$id = router.transitionService._transitionCount++;
123
125
  const toPath = PathUtils.buildToPath(fromPath, targetState);
124
126
  this._treeChanges = PathUtils.treeChanges(
@@ -496,7 +498,7 @@ export class Transition {
496
498
  ) {
497
499
  redirectOpts.location = "replace";
498
500
  }
499
- const newOptions = extend(
501
+ const newOptions = Object.assign(
500
502
  {},
501
503
  this.options(),
502
504
  targetState.options(),
@@ -1,10 +1,4 @@
1
- import {
2
- extend,
3
- forEach,
4
- isDefined,
5
- isFunction,
6
- isObject,
7
- } from "../../../core/utils";
1
+ import { forEach, isDefined, isFunction, isObject } from "../../../core/utils";
8
2
  import { UrlMatcher } from "./urlMatcher";
9
3
  import { DefType, Param } from "../params/param";
10
4
 
@@ -93,7 +87,7 @@ export class UrlMatcherFactory {
93
87
  pattern,
94
88
  urlConfig.paramTypes,
95
89
  this.paramFactory,
96
- extend(globalConfig, config),
90
+ Object.assign(globalConfig, config),
97
91
  );
98
92
  }
99
93
  /**
@@ -1,6 +1,6 @@
1
1
  import { UrlMatcher } from "./urlMatcher";
2
2
  import { isString, isDefined, isFunction } from "../common/predicates";
3
- import { identity, extend } from "../common/common";
3
+ import { identity } from "../common/common";
4
4
  import { is, or, pattern } from "../common/hof";
5
5
  import { StateObject } from "../state/stateObject";
6
6
  /**
@@ -95,7 +95,7 @@ export class UrlRuleFactory {
95
95
  return matched.length / optional.length;
96
96
  }
97
97
  const details = { urlMatcher, matchPriority, type: "URLMATCHER" };
98
- return extend(new BaseUrlRule(matchUrlParamters, _handler), details);
98
+ return Object.assign(new BaseUrlRule(matchUrlParamters, _handler), details);
99
99
  }
100
100
  /**
101
101
  * A UrlRule which matches a state by its url
@@ -130,7 +130,7 @@ export class UrlRuleFactory {
130
130
  }
131
131
  };
132
132
  const details = { state, type: "STATE" };
133
- return extend(this.fromUrlMatcher(state.url, handler), details);
133
+ return Object.assign(this.fromUrlMatcher(state.url, handler), details);
134
134
  }
135
135
  /**
136
136
  * A UrlRule which matches based on a regular expression
@@ -181,7 +181,10 @@ export class UrlRuleFactory {
181
181
  const _handler = isString(handler) ? redirectUrlTo : handler;
182
182
  const matchParamsFromRegexp = (url) => regexp.exec(url.path);
183
183
  const details = { regexp, type: "REGEXP" };
184
- return extend(new BaseUrlRule(matchParamsFromRegexp, _handler), details);
184
+ return Object.assign(
185
+ new BaseUrlRule(matchParamsFromRegexp, _handler),
186
+ details,
187
+ );
185
188
  }
186
189
  }
187
190
  UrlRuleFactory.isUrlRule = (obj) =>
@@ -1,4 +1,4 @@
1
- import { extend, isString } from "../../../core/utils";
1
+ import { isString } from "../../../core/utils";
2
2
  import { is, pattern } from "../common/hof";
3
3
  import { UrlRules } from "./urlRules";
4
4
  import { UrlConfig } from "./urlConfig";
@@ -243,7 +243,7 @@ export class UrlService {
243
243
  * Return the result as a [[MatchResult]].
244
244
  */
245
245
  match(url) {
246
- url = extend({ path: "", search: {}, hash: "" }, url);
246
+ url = Object.assign({ path: "", search: {}, hash: "" }, url);
247
247
  const rules = this.rules.rules();
248
248
  // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined
249
249
  const checkRule = (rule) => {
@@ -8,6 +8,14 @@ import {
8
8
  } from "./adapter/services";
9
9
  import { TemplateFactory } from "./adapter/templateFactory";
10
10
  import { trace } from "./core/common/trace";
11
+ import { $ViewScrollProvider } from "./adapter/viewScroll";
12
+ import { $IsStateFilter, $IncludedByStateFilter } from "./adapter/stateFilters";
13
+ import {
14
+ uiSrefActiveDirective,
15
+ uiStateDirective,
16
+ uiSrefDirective,
17
+ } from "./adapter/directives/stateDirectives";
18
+ import { uiView, $ViewDirectiveFill } from "./adapter/directives/viewDirective";
11
19
 
12
20
  export function initRouter() {
13
21
  window.angular.module("ui.router.angular1", []);
@@ -35,16 +43,26 @@ export function initRouter() {
35
43
  mod_util.provider("$templateFactory", function () {
36
44
  return new TemplateFactory();
37
45
  });
38
- mod_state.provider("$stateRegistry", getProviderFor("stateRegistry"));
39
- mod_state.provider("$uiRouterGlobals", getProviderFor("globals"));
40
- mod_state.provider("$transitions", getProviderFor("transitionService"));
41
- mod_state.provider("$state", ["$uiRouterProvider", getStateProvider]);
42
- mod_state.factory("$stateParams", [
43
- "$uiRouter",
44
- function StateParamse($uiRouter) {
45
- return $uiRouter.globals.params;
46
- },
47
- ]);
46
+ mod_state
47
+ .provider("$stateRegistry", getProviderFor("stateRegistry"))
48
+ .provider("$uiRouterGlobals", getProviderFor("globals"))
49
+ .provider("$transitions", getProviderFor("transitionService"))
50
+ .provider("$state", ["$uiRouterProvider", getStateProvider])
51
+ .provider("$uiViewScroll", $ViewScrollProvider)
52
+ .factory("$stateParams", [
53
+ "$uiRouter",
54
+ function StateParamse($uiRouter) {
55
+ return $uiRouter.globals.params;
56
+ },
57
+ ])
58
+ .filter("isState", $IsStateFilter)
59
+ .filter("includedByState", $IncludedByStateFilter)
60
+ .directive("uiSref", uiSrefDirective)
61
+ .directive("uiSrefActive", uiSrefActiveDirective)
62
+ .directive("uiSrefActiveEq", uiSrefActiveDirective)
63
+ .directive("uiState", uiStateDirective)
64
+ .directive("uiView", uiView)
65
+ .directive("uiView", $ViewDirectiveFill);
48
66
  mod_main.factory("$view", function View() {
49
67
  return router.viewService;
50
68
  });
@@ -1,23 +1,26 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
+ <script></script>
5
+ <script type="module" src="../src/index.js"></script>
4
6
  <script>
5
7
  document.addEventListener("DOMContentLoaded", () => {
6
- window.angular.module("test", ["ui.router"]);
8
+ var myApp = window.angular.module("test", ["ui.router"]);
9
+ myApp.config(function ($stateProvider) {
10
+ var helloState = {
11
+ name: "hello",
12
+ url: "/",
13
+ template: "<h3>hello world!</h3>",
14
+ };
15
+
16
+ $stateProvider.state(helloState);
17
+ });
7
18
  });
8
19
  </script>
9
- <script type="module" src="../src/index.js"></script>
10
20
  </head>
11
21
  <body ng-app="test">
12
- <div ng-init='list = [{ name: "x" }, { name: "y" }, { name: "z" }]'>
13
- <label>Name:</label>
14
- <input type="text" ng-model="yourName" placeholder="Enter a name here" />
15
- <hr />
16
- <h1>Hello {{yourName}}!</h1>
17
-
18
- <ul ng-repeat="i in list">
19
- <li>{{ i.name }}</li>
20
- </ul>
21
- </div>
22
+ {{ 2 + 2 }}
23
+ <a ui-sref="hello" ui-sref-active="active">Hello</a>
24
+ <ui-view></ui-view>
22
25
  </body>
23
26
  </html>
@@ -103,7 +103,6 @@ describe("ngIf", () => {
103
103
 
104
104
  it("should destroy the child scope every time the expression evaluates to false", () => {
105
105
  $scope.value = true;
106
- debugger;
107
106
  element.append($compile('<div ng-if="value"></div>')($scope));
108
107
  $scope.$apply();
109
108
 
@@ -1,21 +1,33 @@
1
1
  <!doctype html>
2
2
  <html>
3
3
  <head>
4
- <script src="../legacy/build/angular.js"></script>
5
- </head>
6
- <body>
7
- Test:
8
- <my-component></my-component>
9
- {{ 2 + 2 }}
10
- </body>
4
+ <script src="../legacy/angular.js"></script>
5
+ <script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script>
6
+ <script>
7
+ var myApp = angular.module("helloworld", ["ui.router"]);
8
+
9
+ myApp.config(function ($stateProvider) {
10
+ var helloState = {
11
+ name: "hello",
12
+ url: "/",
13
+ template: "<h3>hello world!</h3>",
14
+ };
11
15
 
12
- <script>
13
- document.addEventListener("DOMContentLoaded", () => {
14
- window.angular.module("myModule", []).component("myComponent", {
15
- template: "<div>ME</div>",
16
+ var aboutState = {
17
+ name: "about",
18
+ url: "/about",
19
+ template: "<h3>Its the UI-Router hello world app!</h3>",
20
+ };
21
+
22
+ $stateProvider.state(helloState);
23
+ $stateProvider.state(aboutState);
16
24
  });
17
- window.angular.bootstrap(document, ["myModule"]);
18
- //angularInit(document, window.angular.bootstrap);
19
- });
20
- </script>
25
+ </script>
26
+ </head>
27
+ <body ng-app="helloworld">
28
+ <a ui-sref="hello" ui-sref-active="active">Hello</a>
29
+ {{ 2 + 2}}
30
+ <ui-view></ui-view>
31
+ {{ 2 + 2}}
32
+ </body>
21
33
  </html>