@angular-wave/angular.ts 0.7.3 → 0.7.4

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 (206) hide show
  1. package/.prettierignore +2 -1
  2. package/@types/core/exception-handler.d.ts +2 -2
  3. package/@types/core/task-tracker-factory.d.ts +2 -2
  4. package/@types/directive/channel/channel.d.ts +2 -18
  5. package/@types/directive/http/http.d.ts +3 -0
  6. package/@types/directive/script/script.d.ts +2 -2
  7. package/@types/directive/setter/setter.d.ts +2 -2
  8. package/@types/injection-tokens.d.ts +3 -0
  9. package/@types/interface.d.ts +11 -0
  10. package/@types/loader.d.ts +3 -4
  11. package/@types/router/params/param-factory.d.ts +10 -2
  12. package/@types/router/params/param.d.ts +22 -3
  13. package/@types/router/template-factory.d.ts +2 -2
  14. package/@types/router/url/url-service.d.ts +2 -2
  15. package/@types/services/http/http.d.ts +2 -2
  16. package/@types/services/http/interface.d.ts +219 -0
  17. package/@types/services/http-backend/http-backend.d.ts +26 -19
  18. package/@types/services/log/interface.d.ts +33 -0
  19. package/@types/services/log/log.d.ts +25 -0
  20. package/@types/{core → services}/pubsub/pubsub.d.ts +6 -6
  21. package/@types/services/template-cache/interface.d.ts +4 -0
  22. package/@types/services/template-cache/template-cache.d.ts +11 -0
  23. package/@types/services/template-request.d.ts +1 -1
  24. package/@types/shared/cache.d.ts +9 -0
  25. package/@types/shared/dom.d.ts +2 -2
  26. package/Makefile +1 -1
  27. package/dist/angular-ts.esm.js +147 -141
  28. package/dist/angular-ts.umd.js +147 -141
  29. package/dist/angular-ts.umd.min.js +1 -1
  30. package/docs/assets/scss/_variables_project.scss +1 -1
  31. package/docs/assets/scss/_variables_project_after_bs.scss +5 -5
  32. package/docs/assets/scss/index.scss +2 -3
  33. package/docs/content/_index.md +1 -1
  34. package/docs/content/docs/_index.md +58 -25
  35. package/docs/content/docs/directive/_index.md +4 -0
  36. package/docs/content/docs/directive/app.md +11 -0
  37. package/docs/content/docs/directive/aria.md +0 -0
  38. package/docs/content/docs/directive/channel.md +39 -0
  39. package/docs/content/docs/directive/class-even.md +47 -0
  40. package/docs/content/docs/directive/class-odd.md +48 -0
  41. package/docs/content/docs/directive/class.md +64 -0
  42. package/docs/content/docs/directive/cloak.md +78 -0
  43. package/docs/content/docs/directive/include.md +7 -0
  44. package/docs/content/docs/filter/_index.md +4 -0
  45. package/docs/content/docs/provider/_index.md +4 -0
  46. package/docs/content/docs/provider/eventBusProvider.md +35 -0
  47. package/docs/content/docs/provider/logProvider.md +59 -0
  48. package/docs/content/docs/provider/templateCacheProvider.md +35 -0
  49. package/docs/content/docs/service/_index.md +4 -0
  50. package/docs/content/docs/service/eventBus.md +56 -0
  51. package/docs/content/docs/service/log.md +113 -0
  52. package/docs/content/docs/service/templateCache.md +64 -0
  53. package/docs/hugo.yaml +3 -3
  54. package/docs/layouts/partials/hooks/head-end.html +3 -0
  55. package/docs/layouts/shortcodes/showhtml.html +2 -0
  56. package/docs/layouts/shortcodes/showjs.html +2 -0
  57. package/docs/layouts/shortcodes/showraw.html +1 -0
  58. package/docs/static/examples/counter/counter-test.html +17 -0
  59. package/docs/static/examples/counter/counter.html +5 -0
  60. package/docs/static/examples/counter/counter.test.js +28 -0
  61. package/docs/static/examples/eventbus/eventbus-test.html +19 -0
  62. package/docs/static/examples/eventbus/eventbus.html +13 -0
  63. package/docs/static/examples/eventbus/eventbus.js +15 -0
  64. package/docs/static/examples/eventbus/eventbus.test.js +19 -0
  65. package/docs/static/examples/ng-channel/ng-channel-test.html +17 -0
  66. package/docs/static/examples/ng-channel/ng-channel.html +24 -0
  67. package/docs/static/examples/ng-channel/ng-channel.test.js +31 -0
  68. package/docs/static/examples/ng-class/ng-class.html +71 -0
  69. package/docs/static/examples/ng-class/ng-class.js +0 -0
  70. package/docs/static/examples/ng-class-even/ng-class-even.html +8 -0
  71. package/docs/static/examples/ng-class-odd/ng-class-odd.html +8 -0
  72. package/docs/static/typedoc/assets/hierarchy.js +1 -1
  73. package/docs/static/typedoc/assets/navigation.js +1 -1
  74. package/docs/static/typedoc/assets/search.js +1 -1
  75. package/docs/static/typedoc/classes/LogProvider.html +6 -0
  76. package/docs/static/typedoc/classes/PubSub.html +71 -0
  77. package/docs/static/typedoc/classes/PubSubProvider.html +3 -0
  78. package/docs/static/typedoc/classes/TemplateCacheProvider.html +5 -0
  79. package/docs/static/typedoc/hierarchy.html +1 -1
  80. package/docs/static/typedoc/index.html +1 -1
  81. package/docs/static/typedoc/interfaces/ChangesObject.html +1 -1
  82. package/docs/static/typedoc/interfaces/ComponentOptions.html +1 -1
  83. package/docs/static/typedoc/interfaces/Controller.html +1 -1
  84. package/docs/static/typedoc/interfaces/Directive.html +1 -1
  85. package/docs/static/typedoc/interfaces/DirectivePrePost.html +1 -1
  86. package/docs/static/typedoc/interfaces/HttpHeadersGetter.html +1 -0
  87. package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +31 -0
  88. package/docs/static/typedoc/interfaces/HttpRequestConfigHeaders.html +6 -0
  89. package/docs/static/typedoc/interfaces/HttpRequestTransformer.html +1 -0
  90. package/docs/static/typedoc/interfaces/HttpResponse.html +8 -0
  91. package/docs/static/typedoc/interfaces/HttpResponseTransformer.html +1 -0
  92. package/docs/static/typedoc/interfaces/HttpService.html +38 -0
  93. package/docs/static/typedoc/interfaces/LogService.html +12 -0
  94. package/docs/static/typedoc/interfaces/NgModelController.html +1 -1
  95. package/docs/static/typedoc/interfaces/NgModelOptions.html +1 -1
  96. package/docs/static/typedoc/interfaces/Provider.html +1 -1
  97. package/docs/static/typedoc/interfaces/RequestConfig.html +48 -0
  98. package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +38 -0
  99. package/docs/static/typedoc/interfaces/ServiceProvider.html +1 -1
  100. package/docs/static/typedoc/interfaces/TranscludeFunctionObject.html +1 -1
  101. package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
  102. package/docs/static/typedoc/types/CloneAttachFunction.html +1 -1
  103. package/docs/static/typedoc/types/ControllerConstructor.html +1 -1
  104. package/docs/static/typedoc/types/DirectiveCompileFn.html +1 -1
  105. package/docs/static/typedoc/types/DirectiveController.html +1 -1
  106. package/docs/static/typedoc/types/DirectiveFactory.html +1 -1
  107. package/docs/static/typedoc/types/DirectiveLinkFn.html +1 -1
  108. package/docs/static/typedoc/types/ExpandoStore.html +2 -0
  109. package/docs/static/typedoc/types/Expression.html +1 -1
  110. package/docs/static/typedoc/types/FilterFactory.html +1 -1
  111. package/docs/static/typedoc/types/FilterFn.html +1 -1
  112. package/docs/static/typedoc/types/HttpPromise.html +1 -0
  113. package/docs/static/typedoc/types/Injectable.html +1 -1
  114. package/docs/static/typedoc/types/InjectableFactory.html +1 -1
  115. package/docs/static/typedoc/types/LogCall.html +2 -0
  116. package/docs/static/typedoc/types/LogServiceFactory.html +2 -0
  117. package/docs/static/typedoc/types/OnChangesObject.html +1 -1
  118. package/docs/static/typedoc/types/SwapInsertPosition.html +1 -1
  119. package/docs/static/typedoc/types/TController.html +1 -1
  120. package/docs/static/typedoc/types/TemplateCache.html +2 -0
  121. package/docs/static/typedoc/variables/EventBus.html +1 -0
  122. package/index.html +4 -2
  123. package/package.json +3 -3
  124. package/src/animations/animate-css.js +5 -1
  125. package/src/binding.spec.js +3 -1
  126. package/src/core/compile/compile.spec.js +12 -5
  127. package/src/core/core.html +0 -1
  128. package/src/core/exception-handler.js +1 -1
  129. package/src/core/prop.spec.js +1 -0
  130. package/src/core/task-tracker-factory.js +2 -2
  131. package/src/directive/bind/bind.spec.js +1 -4
  132. package/src/directive/channel/channel.js +8 -24
  133. package/src/directive/channel/channel.spec.js +4 -2
  134. package/src/directive/class/class.js +16 -0
  135. package/src/directive/class/class.spec.js +2 -0
  136. package/src/directive/events/event.spec.js +1 -0
  137. package/src/directive/form/form.spec.js +2 -0
  138. package/src/directive/http/http.js +4 -4
  139. package/src/directive/if/if.spec.js +2 -0
  140. package/src/directive/include/include.spec.js +1 -0
  141. package/src/directive/input/input.spec.js +1 -0
  142. package/src/directive/model/model.spec.js +3 -0
  143. package/src/directive/model-options/model-options.spec.js +2 -0
  144. package/src/directive/observe/observe.spec.js +2 -1
  145. package/src/{core/pubsub/pubsub.html → directive/on/on.html} +1 -1
  146. package/src/{core → directive/on}/on.spec.js +5 -3
  147. package/src/directive/on/on.test.js +11 -0
  148. package/src/directive/options/options.spec.js +1 -0
  149. package/src/directive/script/script.js +1 -1
  150. package/src/directive/select/select.spec.js +1 -0
  151. package/src/directive/setter/setter.js +1 -1
  152. package/src/directive/setter/setter.spec.js +2 -0
  153. package/src/directive/switch/switch.spec.js +1 -0
  154. package/src/injection-tokens.js +3 -0
  155. package/src/interface.ts +10 -0
  156. package/src/loader.js +3 -6
  157. package/src/public.js +3 -3
  158. package/src/router/directives/state-directives.spec.js +3 -1
  159. package/src/router/params/param-factory.js +6 -0
  160. package/src/router/params/param.js +22 -7
  161. package/src/router/router.html +0 -1
  162. package/src/router/router.test.js +2 -1
  163. package/src/router/services.spec.js +2 -0
  164. package/src/router/state/state-builder.js +3 -0
  165. package/src/router/state/state-builder.spec.js +2 -0
  166. package/src/router/state/state-service.js +1 -1
  167. package/src/router/state-filter.spec.js +2 -0
  168. package/src/router/template-factory.html +19 -0
  169. package/src/router/template-factory.js +3 -3
  170. package/src/router/template-factory.spec.js +1 -0
  171. package/src/router/template-factory.test.js +12 -0
  172. package/src/router/transition/transition-hook.js +1 -1
  173. package/src/router/url/url-service.js +1 -1
  174. package/src/router/view-scroll.spec.js +3 -1
  175. package/src/services/http/http.js +4 -4
  176. package/src/services/http/http.test.js +1 -1
  177. package/src/services/http/interface.ts +243 -0
  178. package/src/services/http-backend/http-backend.js +21 -11
  179. package/src/services/log/interface.ts +39 -0
  180. package/src/services/log/log.html +19 -0
  181. package/src/services/log/log.js +74 -0
  182. package/src/services/log/log.spec.js +64 -0
  183. package/src/services/log/log.test.js +11 -0
  184. package/src/services/pubsub/pubsub.html +19 -0
  185. package/src/{core → services}/pubsub/pubsub.js +6 -5
  186. package/src/{core → services}/pubsub/pubsub.spec.js +3 -3
  187. package/src/{core → services}/pubsub/pubsub.test.js +1 -1
  188. package/src/services/template-cache/interface.ts +4 -0
  189. package/src/services/template-cache/template-cache.html +22 -0
  190. package/src/services/template-cache/template-cache.js +13 -0
  191. package/src/services/template-cache/template-cache.spec.js +62 -0
  192. package/src/services/template-cache/template-cache.test.js +11 -0
  193. package/src/services/template-request.js +2 -2
  194. package/src/shared/cache.js +9 -0
  195. package/src/shared/dom.js +13 -7
  196. package/utils/express.js +7 -9
  197. package/@types/core/cache/cache-factory.d.ts +0 -22
  198. package/@types/core/cache/cache.d.ts +0 -28
  199. package/@types/services/log.d.ts +0 -53
  200. package/src/core/cache/cache-factory.js +0 -19
  201. package/src/core/cache/cache.js +0 -27
  202. package/src/directive/class/class.md +0 -90
  203. package/src/directive/cloak/cloak.md +0 -24
  204. package/src/examples/counter.html +0 -20
  205. package/src/services/log.js +0 -95
  206. package/src/services/log.md +0 -39
@@ -2,9 +2,10 @@
2
2
 
3
3
  /**
4
4
  * Configurable provider for an injectable event bus
5
- * @implements {ServiceProvider}
5
+ * @extends {ServiceProvider}
6
6
  */
7
7
  export class PubSubProvider {
8
+ /** @private */
8
9
  constructor() {
9
10
  /**
10
11
  * @type {PubSub}
@@ -68,7 +69,7 @@ export class PubSub {
68
69
  * representation minimizes the number of object allocations and has been
69
70
  * shown to be faster than an array of objects with three key-value pairs or
70
71
  * three parallel arrays, especially on IE.) Once a subscription is removed
71
- * via {@link #unsubscribe} or {@link #unsubscribeByKey}, the three
72
+ * via {@link unsubscribe} or {@link unsubscribeByKey}, the three
72
73
  * corresponding array elements are deleted, and never reused. This means the
73
74
  * total number of subscriptions during the lifetime of the pubsub channel is
74
75
  * limited by the maximum length of a JavaScript array to (2^32 - 1) / 3 =
@@ -98,7 +99,7 @@ export class PubSub {
98
99
  * is specified. Subscribing the same function to the same topic multiple
99
100
  * times will result in multiple function invocations while publishing.
100
101
  * Returns a subscription key that can be used to unsubscribe the function from
101
- * the topic via {@link #unsubscribeByKey}.
102
+ * the topic via {@link unsubscribeByKey}.
102
103
  *
103
104
  * @param {string} topic Topic to subscribe to.
104
105
  * @param {Function} fn Function to be invoked when a message is published to
@@ -133,7 +134,7 @@ export class PubSub {
133
134
  * method on the given `opt_context` object, or in the global scope if
134
135
  * no context is specified, and is then unsubscribed. Returns a subscription
135
136
  * key that can be used to unsubscribe the function from the topic via
136
- * {@link #unsubscribeByKey}.
137
+ * {@link unsubscribeByKey}.
137
138
  *
138
139
  * @param {string} topic Topic to subscribe to.
139
140
  * @param {Function} fn Function to be invoked once and then unsubscribed when
@@ -206,7 +207,7 @@ export class PubSub {
206
207
  }
207
208
 
208
209
  /**
209
- * Removes a subscription based on the key returned by {@link #subscribe}.
210
+ * Removes a subscription based on the key returned by {@link subscribe}.
210
211
  * No-op if no matching subscription is found. Returns a Boolean indicating
211
212
  * whether a subscription was removed.
212
213
  *
@@ -1,12 +1,12 @@
1
1
  import { PubSub } from "./pubsub.js";
2
- import { createInjector } from "../di/injector.js";
2
+ import { createInjector } from "../../core/di/injector.js";
3
3
  import { Angular } from "../../loader.js";
4
4
 
5
5
  describe("PubSubProvider", () => {
6
6
  it("should be injectable", () => {
7
- let angular = new Angular();
7
+ const angular = new Angular();
8
8
  angular.module("test", ["ng"]);
9
- let $injector = createInjector(["test"]);
9
+ const $injector = createInjector(["test"]);
10
10
  expect($injector.has("$eventBus")).toBeTrue();
11
11
  expect($injector.get("$eventBus") instanceof PubSub).toBeTrue();
12
12
  expect($injector.get("$eventBus").async_).toBeTrue();
@@ -1,6 +1,6 @@
1
1
  import { test, expect } from "@playwright/test";
2
2
 
3
- const TEST_URL = "src/core/pubsub/pubsub.html";
3
+ const TEST_URL = "src/services/pubsub/pubsub.html";
4
4
 
5
5
  test("unit tests contain no errors", async ({ page }) => {
6
6
  await page.goto(TEST_URL);
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A cache for mapping template names to their respective content.
3
+ */
4
+ export type TemplateCache = Map<string, string>;
@@ -0,0 +1,22 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>AngularTS Test Runner</title>
6
+
7
+ <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
8
+ <link rel="stylesheet" href="/jasmine/jasmine.css" />
9
+ <link rel="stylesheet" href="/public/jasmine-helper.css" />
10
+ <script src="/jasmine/jasmine.js"></script>
11
+ <script src="/jasmine/jasmine-html.js"></script>
12
+ <script src="/jasmine/boot0.js"></script>
13
+ <script src="/jasmine/boot1.js"></script>
14
+ <script
15
+ type="module"
16
+ src="/src/services/template-cache/template-cache.spec.js"
17
+ ></script>
18
+ </head>
19
+ <body>
20
+ <div id="app"></div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Provides an instance of a cache that can be used to store and retrieve template content.
3
+ */
4
+ export class TemplateCacheProvider {
5
+ constructor() {
6
+ /** @type {import('./interface.ts').TemplateCache} */
7
+ this.cache = new Map();
8
+ }
9
+ /**
10
+ * @returns {import('./interface.ts').TemplateCache}
11
+ */
12
+ $get = () => this.cache;
13
+ }
@@ -0,0 +1,62 @@
1
+ import { Angular } from "../../loader.js";
2
+ import { dealoc } from "../../shared/dom.js";
3
+ import { wait } from "../../shared/test-utils.js";
4
+
5
+ describe("$templateCache", () => {
6
+ let templateCache, templateCacheProvider, el, $compile, $scope;
7
+
8
+ beforeEach(() => {
9
+ el = document.getElementById("app");
10
+ el.innerHTML = "";
11
+ let angular = new Angular();
12
+ angular.module("default", []).config(($templateCacheProvider) => {
13
+ templateCacheProvider = $templateCacheProvider;
14
+ templateCacheProvider.cache.set("test", "hello");
15
+ });
16
+ angular
17
+ .bootstrap(el, ["default"])
18
+ .invoke((_$templateCache_, _$compile_, _$rootScope_) => {
19
+ templateCache = _$templateCache_;
20
+ $compile = _$compile_;
21
+ $scope = _$rootScope_;
22
+ });
23
+ });
24
+
25
+ afterEach(() => {
26
+ dealoc(el);
27
+ });
28
+
29
+ it("should be available as provider", () => {
30
+ expect(templateCacheProvider).toBeDefined();
31
+ });
32
+
33
+ it("should be available as a service", () => {
34
+ expect(templateCache).toBeDefined();
35
+ expect(templateCache).toEqual(templateCacheProvider.cache);
36
+ expect(templateCache instanceof Map).toBeTrue();
37
+ expect(templateCache.get("test")).toEqual("hello");
38
+ });
39
+
40
+ it("should can be accessed via `ng-include`", async () => {
41
+ el.innerHTML = `
42
+ <div ng-include="'test'">test</div>
43
+ `;
44
+ expect(el.innerText).toEqual("test");
45
+ $compile(el)($scope);
46
+ await wait();
47
+ expect(el.innerText).toEqual("hello");
48
+ });
49
+
50
+ it("can be leader via `text/ng-template`", async () => {
51
+ el.innerHTML = `
52
+ <script type="text/ng-template" id="templateId.html">
53
+ <p>This is the content of the template</p>
54
+ </script>
55
+ `;
56
+ $compile(el)($scope);
57
+ await wait();
58
+ expect(templateCache.get("templateId.html").trim()).toEqual(
59
+ "<p>This is the content of the template</p>",
60
+ );
61
+ });
62
+ });
@@ -0,0 +1,11 @@
1
+ import { test, expect } from "@playwright/test";
2
+
3
+ const TEST_URL = "src/services/template-cache/template-cache.html";
4
+
5
+ test("unit tests contain no errors", async ({ page }) => {
6
+ await page.goto(TEST_URL);
7
+ await page.content();
8
+ await expect(page.locator(".jasmine-overall-result")).toHaveText(
9
+ /0 failures/,
10
+ );
11
+ });
@@ -61,8 +61,8 @@ export function TemplateRequestProvider() {
61
61
  /**
62
62
  *
63
63
  * @param {import('../core/exception-handler.js').ErrorHandler} $exceptionHandler
64
- * @param {import('../core/cache/cache-factory.js').TemplateCache} $templateCache
65
- * @param {*} $http
64
+ * @param {import('../services/template-cache/interface.ts').TemplateCache} $templateCache
65
+ * @param {import("interface.ts").HttpService} $http
66
66
  * @param {*} $sce
67
67
  * @returns
68
68
  */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Expando cache for adding properties to DOM nodes with JavaScript.
3
+ * This used to be an Object in JQLite decorator, but swapped out for a Map
4
+ * for performance reasons and convenience methods. A proxy is available for
5
+ * additional logic handling.
6
+ *
7
+ * @type {Map<number, import('../interface.ts').ExpandoStore>}
8
+ */
9
+ export const Cache = new Map();
package/src/shared/dom.js CHANGED
@@ -1,14 +1,20 @@
1
1
  import { concat, hasOwn, isDefined, isObject } from "./utils.js";
2
- import {
3
- Cache,
4
- EXPANDO,
5
- ISOLATE_SCOPE_KEY,
6
- SCOPE_KEY,
7
- } from "../core/cache/cache.js";
2
+ import { Cache } from "./cache.js";
8
3
 
9
4
  /** @type {number} */
10
5
  let jqId = 1;
11
6
 
7
+ /**
8
+ * Key for storing isolate scope data, attached to an element
9
+ */
10
+ const ISOLATE_SCOPE_KEY = "$isolateScope";
11
+ const EXPANDO = "ng";
12
+
13
+ /**
14
+ * Key for storing scope data, attached to an element
15
+ */
16
+ const SCOPE_KEY = "$scope";
17
+
12
18
  const DASH_LOWERCASE_REGEXP = /-([a-z])/g;
13
19
  const UNDERSCORE_LOWERCASE_REGEXP = /_([a-z])/g;
14
20
  const SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;
@@ -129,7 +135,7 @@ export function removeElementData(element, name) {
129
135
  *
130
136
  * @param {Element} element
131
137
  * @param {boolean} [createIfNecessary=false]
132
- * @returns {import("../core/cache/cache.js").ExpandoStore}
138
+ * @returns {import("../interface.ts").ExpandoStore}
133
139
  */
134
140
  export function getExpando(element, createIfNecessary = false) {
135
141
  let expandoId = element[EXPANDO];
package/utils/express.js CHANGED
@@ -2,11 +2,7 @@ import express from "express";
2
2
  const app = express();
3
3
  const port = 3000;
4
4
 
5
- app.use(express.json());
6
- app.use(express.urlencoded({ extended: true }));
7
-
8
5
  app.use("/post", express.json());
9
- app.use("/form", express.json());
10
6
  app.use("/nocontent", express.json());
11
7
  app.use((req, res, next) => {
12
8
  res.header("Access-Control-Allow-Origin", "*"); // Change * to your desired origin if needed
@@ -68,11 +64,6 @@ app.post("/hello", (req, res) => {
68
64
  res.json("Hello");
69
65
  });
70
66
 
71
- app.post("/posthtml", (req, res) => {
72
- console.log(req.body);
73
- res.send(`<div>Post response ${req.body.name} </div>`);
74
- });
75
-
76
67
  app.get("/interpolation", (req, res) => {
77
68
  res.send("{{expr}}");
78
69
  });
@@ -169,3 +160,10 @@ app.listen(port, () => {
169
160
  app.get("/my-messages", (req, res) => {
170
161
  res.send('<div ng-message="required">You did not enter a value</div>');
171
162
  });
163
+
164
+ app.use("/posthtml", express.json());
165
+ app.use("/posthtml", express.urlencoded({ extended: true }));
166
+ app.post("/posthtml", (req, res) => {
167
+ console.log(req.body);
168
+ res.send(`<div>Post response ${req.body.name} </div>`);
169
+ });
@@ -1,22 +0,0 @@
1
- /**
2
- * A cache for maping template names to their respective content.
3
- *
4
- * @typedef {Map<string, string>} TemplateCache
5
- */
6
- /**
7
- * Service responsible for providing a cache for templates.
8
- *
9
- * @class TemplateCacheProvider
10
- * @description Provides an instance of a template cache that can be used to store and retrieve template content.
11
- */
12
- export class TemplateCacheProvider {
13
- /**
14
- * @description Returns a new instance of a `TemplateCache`, which is a Map used to store templates.
15
- * @returns {TemplateCache} A new instance of the template cache (Map object).
16
- */
17
- $get: () => TemplateCache;
18
- }
19
- /**
20
- * A cache for maping template names to their respective content.
21
- */
22
- export type TemplateCache = Map<string, string>;
@@ -1,28 +0,0 @@
1
- /**
2
- * @typedef {Object} ExpandoStore
3
- * @property {!Object<string, any>} data
4
- *
5
- */
6
- export const EXPANDO: "ng";
7
- /**
8
- * Expando cache for adding properties to DOM nodes with JavaScript.
9
- * This used to be an Object in JQLite decorator, but swapped out for a Map
10
- * for performance reasons and convenience methods. A proxy is available for
11
- * additional logic handling.
12
- *
13
- * @type {Map<number, ExpandoStore>}
14
- */
15
- export const Cache: Map<number, ExpandoStore>;
16
- /**
17
- * Key for storing scope data, attached to an element
18
- */
19
- export const SCOPE_KEY: "$scope";
20
- /**
21
- * Key for storing isolate scope data, attached to an element
22
- */
23
- export const ISOLATE_SCOPE_KEY: "$isolateScope";
24
- export type ExpandoStore = {
25
- data: {
26
- [x: string]: any;
27
- };
28
- };
@@ -1,53 +0,0 @@
1
- export type LogService = {
2
- /**
3
- * - Log a debug messages
4
- */
5
- debug: LogCall;
6
- /**
7
- * - Log a error message
8
- */
9
- error: LogCall;
10
- /**
11
- * - Log a info message
12
- */
13
- info: LogCall;
14
- /**
15
- * - Log a general message
16
- */
17
- log: LogCall;
18
- /**
19
- * - Log a warning message
20
- */
21
- warn: LogCall;
22
- };
23
- /**
24
- * @typedef {(...args: any[]) => void} LogCall
25
- */
26
- /**
27
- * @typedef {Object} LogService
28
- * @property {LogCall} debug - Log a debug messages
29
- * @property {LogCall} error - Log a error message
30
- * @property {LogCall} info - Log a info message
31
- * @property {LogCall} log - Log a general message
32
- * @property {LogCall} warn - Log a warning message
33
- */
34
- /**
35
- * @type {LogService}
36
- */
37
- export let LogService: LogService;
38
- /**
39
- * @type {LogProvider}
40
- * Use the `$logProvider` to configure how the application logs messages
41
- */
42
- export class LogProvider {
43
- debug: any;
44
- /**
45
- * @param {boolean=} flag enable or disable debug level messages
46
- * @returns {*} current value if used as getter or itself (chaining) if used as setter
47
- */
48
- debugEnabled(flag?: boolean | undefined): any;
49
- formatError(arg: any): any;
50
- consoleLog(type: any): (...args: any[]) => any;
51
- $get(): LogService;
52
- }
53
- export type LogCall = (...args: any[]) => void;
@@ -1,19 +0,0 @@
1
- /**
2
- * A cache for maping template names to their respective content.
3
- *
4
- * @typedef {Map<string, string>} TemplateCache
5
- */
6
-
7
- /**
8
- * Service responsible for providing a cache for templates.
9
- *
10
- * @class TemplateCacheProvider
11
- * @description Provides an instance of a template cache that can be used to store and retrieve template content.
12
- */
13
- export class TemplateCacheProvider {
14
- /**
15
- * @description Returns a new instance of a `TemplateCache`, which is a Map used to store templates.
16
- * @returns {TemplateCache} A new instance of the template cache (Map object).
17
- */
18
- $get = () => new Map();
19
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * @typedef {Object} ExpandoStore
3
- * @property {!Object<string, any>} data
4
- *
5
- */
6
-
7
- export const EXPANDO = "ng";
8
-
9
- /**
10
- * Expando cache for adding properties to DOM nodes with JavaScript.
11
- * This used to be an Object in JQLite decorator, but swapped out for a Map
12
- * for performance reasons and convenience methods. A proxy is available for
13
- * additional logic handling.
14
- *
15
- * @type {Map<number, ExpandoStore>}
16
- */
17
- export const Cache = new Map();
18
-
19
- /**
20
- * Key for storing scope data, attached to an element
21
- */
22
- export const SCOPE_KEY = "$scope";
23
-
24
- /**
25
- * Key for storing isolate scope data, attached to an element
26
- */
27
- export const ISOLATE_SCOPE_KEY = "$isolateScope";
@@ -1,90 +0,0 @@
1
- /\*\*
2
-
3
- - The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
4
- - an expression that represents all classes to be added.
5
- -
6
- - The directive operates in three different ways, depending on which of three types the expression
7
- - evaluates to:
8
- -
9
- - 1. If the expression evaluates to a string, the string should be one or more space-delimited class
10
- - names.
11
- -
12
- - 2. If the expression evaluates to an object, then for each key-value pair of the
13
- - object with a truthy value the corresponding key is used as a class name.
14
- -
15
- - 3. If the expression evaluates to an array, each element of the array should either be a string as in
16
- - type 1 or an object as in type 2. This means that you can mix strings and objects together in an array
17
- - to give you more control over what CSS classes appear. See the code below for an example of this.
18
- -
19
- -
20
- - The directive won't add duplicate classes if a particular class was already set.
21
- -
22
- - When the expression changes, the previously added classes are removed and only then are the
23
- - new classes added.
24
- -
25
- - @knownIssue
26
- - You should not use {@link guide/interpolation interpolation} in the value of the `class`
27
- - attribute, when using the `ngClass` directive on the same element.
28
- - See {@link guide/interpolation#known-issues here} for more info.
29
- -
30
- - @animations
31
- - | Animation | Occurs |
32
- - |----------------------------------|-------------------------------------|
33
- - | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
34
- - | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
35
- - | {@link ng.$animate#setClass setClass} | just before classes are added and classes are removed from the element at the same time |
36
- -
37
- - ### ngClass and pre-existing CSS3 Transitions/Animations
38
- The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
39
- Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
40
- any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
41
- to view the step by step details of {@link $animate#addClass $animate.addClass} and
42
- {@link $animate#removeClass $animate.removeClass}.
43
- -
44
- - @param {String} ngClass {@link guide/expression Expression} to eval. The result
45
- - of the evaluation can be a string representing space delimited class
46
- - names, an array, or a map of class names to boolean values. In the case of a map, the
47
- - names of the properties whose values are truthy will be added as css classes to the
48
- - element.
49
- - \*/
50
-
51
- /\*\*
52
-
53
- - The `ngClassOdd` and `ngClassEven` directives work exactly as
54
- - {@link ng.directive:ngClass ngClass}, except they work in
55
- - conjunction with `ngRepeat` and take effect only on odd (even) rows.
56
- -
57
- - This directive can be applied only within the scope of an
58
- - {@link ng.directive:ngRepeat ngRepeat}.
59
- -
60
- - @animations
61
- - | Animation | Occurs |
62
- - |----------------------------------|-------------------------------------|
63
- - | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
64
- - | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
65
- -
66
- - @element ANY
67
- - @param {string} ngClassOdd {@link guide/expression Expression} to eval. The result
68
- - of the evaluation can be a string representing space delimited class names or an array.
69
- -
70
- - \*/
71
-
72
- /\*\*
73
-
74
- - The `ngClassOdd` and `ngClassEven` directives work exactly as
75
- - {@link ng.directive:ngClass ngClass}, except they work in
76
- - conjunction with `ngRepeat` and take effect only on odd (even) rows.
77
- -
78
- - This directive can be applied only within the scope of an
79
- - {@link ng.directive:ngRepeat ngRepeat}.
80
- -
81
- - @animations
82
- - | Animation | Occurs |
83
- - |----------------------------------|-------------------------------------|
84
- - | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
85
- - | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
86
- -
87
- - @element ANY
88
- - @param {string} ngClassEven {@link guide/expression Expression} to eval. The
89
- - result of the evaluation can be a string representing space delimited class names or an array.
90
- - \*/
@@ -1,24 +0,0 @@
1
- ## `ngCloak` Directive
2
-
3
- ### Restrict
4
-
5
- `AC`
6
-
7
- ### Description
8
-
9
- The `ngCloak` directive is used to prevent the AngularTS HTML template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading. Use this directive to avoid the undesirable flicker effect caused by the HTML template display.
10
-
11
- The directive can be applied to the `<body>` element, but the preferred usage is to apply multiple `ngCloak` directives to small portions of the page to permit progressive rendering of the browser view.
12
-
13
- `ngCloak` works in cooperation with the following CSS rule embedded within `angular.js` and `angular.min.js`. For CSP mode, please add `angular-csp.css` to your HTML file (see [`ngCsp`](ng.directive:ngCsp)).
14
-
15
- ```css
16
- [ng\:cloak],
17
- [ng-cloak],
18
- [data-ng-cloak],
19
- [ng-cloak],
20
- .ng-cloak,
21
- .ng-cloak {
22
- display: none !important;
23
- }
24
- ```
@@ -1,20 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <title>AngularTS</title>
6
- <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
7
- <script type="module" src="/src/index.js"></script>
8
- <link rel="stylesheet" href="/css/angular.css" />
9
- <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
10
- </head>
11
- <body ng-app ng-cloak>
12
- <button
13
- class="bg-gray-100 p-2 rounded-md outline outline-gray-950/10 m-6"
14
- ng-init="count = 0"
15
- ng-click="count = count + 1"
16
- >
17
- Count is: {{ count }}
18
- </button>
19
- </body>
20
- </html>
@@ -1,95 +0,0 @@
1
- import { isError } from "../shared/utils.js";
2
-
3
- ///////////////////////////////////////////////////////////////////////////
4
- // LogService
5
- // see http://docs.angularjs.org/api/ng/service/$log
6
- // see http://docs.angularjs.org/api/ng/provider/$logProvider
7
- ///////////////////////////////////////////////////////////////////////////
8
-
9
- /**
10
- * @typedef {(...args: any[]) => void} LogCall
11
- */
12
-
13
- /**
14
- * @typedef {Object} LogService
15
- * @property {LogCall} debug - Log a debug messages
16
- * @property {LogCall} error - Log a error message
17
- * @property {LogCall} info - Log a info message
18
- * @property {LogCall} log - Log a general message
19
- * @property {LogCall} warn - Log a warning message
20
- */
21
-
22
- /**
23
- * @type {LogService}
24
- */
25
- export let LogService = {
26
- debug: undefined,
27
- error: undefined,
28
- info: undefined,
29
- log: undefined,
30
- warn: undefined,
31
- };
32
-
33
- /**
34
- * @type {LogProvider}
35
- * Use the `$logProvider` to configure how the application logs messages
36
- */
37
- export class LogProvider {
38
- constructor() {
39
- this.debug = true;
40
- }
41
-
42
- /**
43
- * @param {boolean=} flag enable or disable debug level messages
44
- * @returns {*} current value if used as getter or itself (chaining) if used as setter
45
- */
46
- debugEnabled(flag) {
47
- if (typeof flag !== "undefined") {
48
- this.debug = flag;
49
- return this;
50
- }
51
- return this.debug;
52
- }
53
-
54
- formatError(arg) {
55
- if (isError(arg)) {
56
- if (arg.stack) {
57
- arg =
58
- arg.message && arg.stack.indexOf(arg.message) === -1
59
- ? `Error: ${arg.message}\n${arg.stack}`
60
- : arg.stack;
61
- } else if (arg.sourceURL) {
62
- arg = `${arg.message}\n${arg.sourceURL}:${arg.line}`;
63
- }
64
- }
65
- return arg;
66
- }
67
-
68
- consoleLog(type) {
69
- const console = window.console || {};
70
- const logFn = console[type] || console.log || (() => {});
71
-
72
- return (...args) => {
73
- const formattedArgs = args.map((arg) => this.formatError(arg));
74
- return logFn.apply(console, formattedArgs);
75
- };
76
- }
77
-
78
- $get() {
79
- LogService = {
80
- log: this.consoleLog("log"),
81
- info: this.consoleLog("info"),
82
- warn: this.consoleLog("warn"),
83
- error: this.consoleLog("error"),
84
- debug: (() => {
85
- const fn = this.consoleLog("debug");
86
- return (...args) => {
87
- if (this.debug) {
88
- fn.apply(this, args);
89
- }
90
- };
91
- })(),
92
- };
93
- return LogService;
94
- }
95
- }