@angular-wave/angular.ts 0.0.35 → 0.0.37
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.
- package/.eslintrc.cjs +1 -1
- package/Makefile +4 -0
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/index.html +3 -102
- package/package.json +2 -2
- package/playwright.config.ts +4 -3
- package/public/public/my_other_directive.html +1 -0
- package/{test → src}/angular.spec.js +6 -6
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-queue.js +1 -1
- package/src/animations/animation.js +1 -1
- package/src/animations/shared.js +1 -1
- package/{test → src}/binding.spec.js +3 -3
- package/src/core/{animate-runner.js → animate/animate-runner.js} +1 -1
- package/src/core/animate/animate.html +18 -0
- package/src/core/{animate.js → animate/animate.js} +4 -5
- package/{test/core → src/core/animate}/animate.spec.js +1 -1
- package/src/core/cache/cache-factor.html +18 -0
- package/{test/core → src/core/cache}/cache-factor.spec.js +2 -2
- package/src/core/cache/cache-factor.test.js +11 -0
- package/src/core/compile/compile.html +18 -0
- package/src/core/{compile.js → compile/compile.js} +25 -21
- package/{test/core → src/core/compile}/compile.spec.js +65 -68
- package/src/core/compile/compile.test.js +12 -0
- package/src/core/controller/controller.html +21 -0
- package/src/core/{controller.js → controller/controller.js} +1 -1
- package/{test/core/controller-provider.spec.js → src/core/controller/controller.spec.js} +2 -2
- package/src/core/controller/controller.test.js +11 -0
- package/{test → src}/core/cookie-reader.spec.js +2 -2
- package/{test → src}/core/document.spec.js +3 -3
- package/src/core/filter/filter.html +18 -0
- package/src/core/{filter.js → filter/filter.js} +5 -5
- package/{test/core → src/core/filter}/filter.spec.js +2 -2
- package/src/core/filter/filter.test.js +11 -0
- package/src/core/interpolate/interpolate.html +21 -0
- package/src/core/{interpolate.js → interpolate/interpolate.js} +1 -1
- package/{test/core → src/core/interpolate}/interpolate.spec.js +2 -2
- package/src/core/interpolate/interpolate.test.js +11 -0
- package/src/core/{interval-factory.js → interval/interval-factory.js} +2 -1
- package/src/core/interval/interval.html +18 -0
- package/src/core/{interval.js → interval/interval.js} +3 -2
- package/{test/core → src/core/interval}/interval.spec.js +6 -10
- package/src/core/interval/interval.test.js +12 -0
- package/src/core/{location.js → location/location.js} +4 -3
- package/{test/core → src/core/location}/location.spec.js +3 -3
- package/{test → src}/core/on.spec.js +3 -3
- package/src/core/parser/parse.js +2 -3
- package/{test/core → src/core/parser}/parse.spec.js +4 -4
- package/{test → src}/core/prop.spec.js +4 -4
- package/{test/core → src/core/pubsub}/pubsub.spec.js +1 -1
- package/src/core/{q.js → q/q.js} +1 -1
- package/{test/core → src/core/q}/q.spec.js +3 -3
- package/{test → src}/core/root-element.spec.js +3 -3
- package/src/core/{sanitize-uri.js → sanitize/sanitize-uri.js} +2 -2
- package/{test/core → src/core/sanitize}/sanitize-uri.spec.js +1 -1
- package/src/core/{sce.js → sce/sce.js} +3 -3
- package/{test/core → src/core/sce}/sce.spec.js +3 -3
- package/src/core/{root-scope.js → scope/scope.js} +33 -35
- package/{test/core → src/core/scope}/scope.spec.js +5 -5
- package/src/core/{timeout.js → timeout/timeout.js} +2 -2
- package/{test/core → src/core/timeout}/timeout.spec.js +2 -2
- package/src/core/{urlUtils.js → url-utils/url-utils.js} +1 -1
- package/{test/core → src/core/url-utils}/url-utils.spec.js +1 -1
- package/src/directive/attrs/attrs.html +18 -0
- package/src/directive/{attrs.js → attrs/attrs.js} +3 -3
- package/{test/directive/scrset.spec.js → src/directive/attrs/attrs.spec.js} +3 -3
- package/{test/directive → src/directive/attrs}/boolean.spec.js +3 -3
- package/{test/directive → src/directive/attrs}/element-style.spec.js +3 -3
- package/src/directive/attrs/src.html +18 -0
- package/{test/directive → src/directive/attrs}/src.spec.js +3 -3
- package/src/directive/attrs/src.test.js +11 -0
- package/src/directive/bind/bind.html +18 -0
- package/src/directive/{bind.js → bind/bind.js} +1 -1
- package/{test/directive → src/directive/bind}/bind.spec.js +3 -3
- package/src/directive/bind/bind.test.js +11 -0
- package/{test/sanitize → src/directive/bind}/bing-html.spec.js +3 -3
- package/src/directive/change/change.html +18 -0
- package/{test/directive → src/directive/change}/change.spec.js +3 -3
- package/src/directive/change/change.test.js +11 -0
- package/src/directive/class/class.html +18 -0
- package/src/directive/{class.js → class/class.js} +3 -3
- package/{test/directive → src/directive/class}/class.spec.js +5 -5
- package/src/directive/class/class.test.js +11 -0
- package/src/directive/cloak/cloak.html +18 -0
- package/{test/directive → src/directive/cloak}/cloak.spec.js +3 -3
- package/src/directive/cloak/cloak.test.js +11 -0
- package/src/directive/controller/controller.html +21 -0
- package/{test/directive → src/directive/controller}/controller.spec.js +5 -5
- package/src/directive/controller/controller.test.js +11 -0
- package/{test/directive → src/directive/events}/click.spec.js +3 -3
- package/{test/directive → src/directive/events}/event.spec.js +4 -4
- package/src/directive/events/events.html +18 -0
- package/src/directive/{events.js → events/events.js} +2 -2
- package/src/directive/events/events.test.js +11 -0
- package/src/directive/form/form.html +18 -0
- package/src/directive/{form.js → form/form.js} +2 -2
- package/{test/directive → src/directive/form}/form.spec.js +5 -5
- package/src/directive/form/form.test.js +11 -0
- package/src/directive/if/if.html +18 -0
- package/src/directive/{if.js → if/if.js} +2 -1
- package/src/directive/if/if.md +77 -0
- package/{test/directive → src/directive/if}/if.spec.js +16 -16
- package/src/directive/if/if.test.js +12 -0
- package/src/directive/include/include.html +18 -0
- package/src/directive/{include.js → include/include.js} +2 -2
- package/{test/directive → src/directive/include}/include.spec.js +52 -71
- package/src/directive/include/include.test.js +12 -0
- package/src/directive/init/init.html +18 -0
- package/{test/directive → src/directive/init}/init.spec.js +4 -4
- package/src/directive/init/init.test.js +11 -0
- package/src/directive/input/input.html +18 -0
- package/src/directive/{input.js → input/input.js} +2 -2
- package/{test/directive → src/directive/input}/input.spec.js +5 -9
- package/src/directive/input/input.test.js +11 -0
- package/src/directive/list/list.html +18 -0
- package/src/directive/{list.js → list/list.js} +1 -1
- package/{test/directive → src/directive/list}/list.spec.js +3 -3
- package/src/directive/list/list.test.js +11 -0
- package/src/directive/model/model.html +18 -0
- package/src/directive/{model.js → model/model.js} +10 -6
- package/{test/directive → src/directive/model}/model.spec.js +8 -8
- package/src/directive/model/model.test.js +11 -0
- package/src/directive/model-options/model-option.test.js +11 -0
- package/src/directive/model-options/model-options.html +21 -0
- package/src/directive/{model-options.js → model-options/model-options.js} +1 -1
- package/{test/directive → src/directive/model-options}/model-options.spec.js +7 -7
- package/src/directive/non-bindable/non-bindable.html +21 -0
- package/{test/directive → src/directive/non-bindable}/non-bindable.spec.js +3 -3
- package/src/directive/non-bindable/non-bindable.test.js +11 -0
- package/src/directive/options/options.html +21 -0
- package/src/directive/{options.js → options/options.js} +8 -6
- package/{test/directive → src/directive/options}/options.spec.js +5 -5
- package/src/directive/options/options.test.js +11 -0
- package/src/directive/ref/href.html +18 -0
- package/{test/directive → src/directive/ref}/href.spec.js +4 -4
- package/src/directive/ref/href.test.js +17 -0
- package/src/directive/ref/ref.html +18 -0
- package/src/directive/{ref.js → ref/ref.js} +1 -1
- package/{test/directive → src/directive/ref}/ref.spec.js +2 -2
- package/src/directive/repeat/repeat.html +18 -0
- package/src/directive/{repeat.js → repeat/repeat.js} +13 -13
- package/{test/directive → src/directive/repeat}/repeat.spec.js +8 -9
- package/src/directive/repeat/repeat.test.js +11 -0
- package/src/directive/script/script.html +18 -0
- package/{test/directive → src/directive/script}/script.spec.js +3 -3
- package/src/directive/script/script.test.js +11 -0
- package/src/directive/select/select.html +18 -0
- package/src/directive/{select.js → select/select.js} +2 -2
- package/{test/directive → src/directive/select}/select.spec.js +5 -5
- package/src/directive/select/select.test.js +11 -0
- package/src/directive/show-hide/show-hide.html +21 -0
- package/{test/directive → src/directive/show-hide}/show-hide.spec.js +3 -3
- package/src/directive/show-hide/show-hide.test.js +11 -0
- package/src/directive/style/style.html +18 -0
- package/{test/directive → src/directive/style}/style.spec.js +3 -3
- package/src/directive/style/style.test.js +11 -0
- package/src/directive/switch/switch.html +18 -0
- package/src/directive/{switch.js → switch/switch.js} +3 -3
- package/{test/directive → src/directive/switch}/switch.spec.js +3 -3
- package/src/directive/switch/switch.test.js +11 -0
- package/src/directive/{transclude.js → transclude/transclude.js} +2 -2
- package/src/directive/validators/validators.html +21 -0
- package/src/directive/{validators.js → validators/validators.js} +3 -3
- package/{test/directive → src/directive/validators}/validators.spec.js +3 -3
- package/src/directive/validators/validators.test.js +11 -0
- package/src/exts/aria/aria.html +21 -0
- package/src/exts/{aria.js → aria/aria.js} +1 -1
- package/{test → src/exts}/aria/aria.spec.js +3 -3
- package/src/exts/aria/aria.test.js +11 -0
- package/src/exts/messages/messages.html +21 -0
- package/src/exts/{messages.js → messages/messages.js} +1 -1
- package/{test → src/exts}/messages/messages.spec.js +5 -5
- package/src/exts/messages/messages.test.js +11 -0
- package/{test/filter → src/filters}/filter.spec.js +10 -5
- package/{test/filter → src/filters}/filters.spec.js +3 -3
- package/{test/filter → src/filters}/limit-to.spec.js +3 -3
- package/{test/filter → src/filters}/order-by.spec.js +2 -2
- package/src/injector.js +1 -2
- package/{test → src}/injector.spec.js +4 -4
- package/src/loader.js +2 -2
- package/{test → src}/loader.spec.js +2 -2
- package/src/public.js +48 -45
- package/{test → src}/public.spec.js +2 -2
- package/src/router/common/glob.html +18 -0
- package/{test/router → src/router/common}/glob.spec.js +1 -1
- package/src/router/common/glob.test.js +11 -0
- package/src/router/directives/view-directive.js +1 -1
- package/{test → src}/router/services.spec.js +2 -2
- package/src/router/state/state-service.js +1 -1
- package/{test/router/ng-state-builder.spec.js → src/router/state-builder.spec.js} +1 -1
- package/{test → src}/router/state-directives.spec.js +3 -3
- package/{test → src}/router/state-filter.spec.js +2 -2
- package/{test → src}/router/state.spec.js +5 -5
- package/{test → src}/router/template-factory.spec.js +3 -3
- package/src/router/transition/transition-hook.js +1 -1
- package/{test → src}/router/url-service.spec.js +4 -4
- package/{test → src}/router/view-directive.spec.js +3 -3
- package/{test → src}/router/view-hook.spec.js +3 -3
- package/{test → src}/router/view-scroll.spec.js +3 -3
- package/{test → src}/router/view.spec.js +12 -12
- package/src/services/browser.js +2 -2
- package/src/services/cache-factory.js +5 -11
- package/src/services/document.js +1 -1
- package/src/services/{http.js → http/http.js} +5 -6
- package/{test/core → src/services/http}/http.spec.js +3 -3
- package/{test/core → src/services/http}/template-request.spec.js +2 -2
- package/src/services/{http-backend.js → http-backend/http-backend.js} +2 -2
- package/{test/core → src/services/http-backend}/http-backend.spec.js +3 -3
- package/src/services/template-request.js +1 -1
- package/{test → src}/shared/common.spec.js +4 -4
- package/{test → src}/shared/hof.spec.js +1 -1
- package/src/shared/jqlite/jqlite.html +18 -0
- package/src/{jqLite.js → shared/jqlite/jqlite.js} +2 -2
- package/{test → src/shared/jqlite}/jqlite.spec.js +7 -7
- package/src/shared/jqlite/jqlite.test.js +11 -0
- package/{test → src/shared}/min-err.spec.js +2 -2
- package/{test → src}/shared/strings.spec.js +1 -1
- package/{test → src/shared}/test-utils.js +1 -1
- package/src/shared/utils.js +3 -18
- package/{test → src}/shared/utils.spec.js +1 -1
- package/tsconfig.json +1 -1
- package/types/animations/animate-cache.d.ts +12 -0
- package/types/animations/animate-children-directive.d.ts +84 -0
- package/types/animations/animate-swap.d.ts +103 -0
- package/types/animations/animation.d.ts +14 -0
- package/types/animations/module.d.ts +750 -0
- package/types/animations/raf-scheduler.d.ts +5 -0
- package/types/animations/shared.d.ts +65 -0
- package/types/constants.d.ts +18 -0
- package/types/core/animate-css.d.ts +25 -0
- package/types/core/cache.d.ts +25 -0
- package/types/core/compile.d.ts +206 -0
- package/types/core/controller.d.ts +42 -0
- package/types/core/exception-handler.d.ts +46 -0
- package/types/core/filter.d.ts +9 -0
- package/types/core/interpolate.d.ts +83 -0
- package/types/core/interval-factory.d.ts +21 -0
- package/types/core/interval.d.ts +4 -0
- package/types/core/location.d.ts +234 -0
- package/types/core/pubsub.d.ts +164 -0
- package/types/core/q.d.ts +33 -0
- package/types/core/root-scope.d.ts +754 -0
- package/types/core/sanitize-uri.d.ts +57 -0
- package/types/core/sce.d.ts +432 -0
- package/types/core/task-tracker-factory.d.ts +50 -0
- package/types/core/timeout.d.ts +31 -0
- package/types/core/urlUtils.d.ts +98 -0
- package/types/directive/attrs.d.ts +176 -0
- package/types/directive/bind.d.ts +21 -0
- package/types/directive/change.d.ts +4 -0
- package/types/directive/class.d.ts +125 -0
- package/types/directive/cloak.d.ts +4 -0
- package/types/directive/controller.d.ts +6 -0
- package/types/directive/events.d.ts +12 -0
- package/types/directive/form.d.ts +230 -0
- package/types/directive/if.d.ts +17 -0
- package/types/directive/include.d.ts +33 -0
- package/types/directive/init.d.ts +4 -0
- package/types/directive/input.d.ts +192 -0
- package/types/directive/list.d.ts +4 -0
- package/types/directive/model.d.ts +672 -0
- package/types/directive/non-bindable.d.ts +5 -0
- package/types/directive/options.d.ts +16 -0
- package/types/directive/ref.d.ts +11 -0
- package/types/directive/repeat.d.ts +23 -0
- package/types/directive/script.d.ts +23 -0
- package/types/directive/show-hide.d.ts +234 -0
- package/types/directive/style.d.ts +4 -0
- package/types/directive/switch.d.ts +23 -0
- package/types/directive/transclude.d.ts +15 -0
- package/types/directive/validators.d.ts +173 -0
- package/types/exts/aria.d.ts +1 -0
- package/types/exts/messages.d.ts +1 -0
- package/types/filters/filter.d.ts +4 -0
- package/types/filters/filters.d.ts +38 -0
- package/types/filters/limit-to.d.ts +4 -0
- package/types/filters/order-by.d.ts +11 -0
- package/types/jqLite.d.ts +57 -0
- package/types/router/common/coreservices.d.ts +4 -0
- package/types/router/common/glob.d.ts +60 -0
- package/types/router/common/queue.d.ts +15 -0
- package/types/router/common/trace.d.ts +72 -0
- package/types/router/directives/view-directive.d.ts +160 -0
- package/types/router/globals.d.ts +30 -0
- package/types/router/hooks/core-resolvables.d.ts +2 -0
- package/types/router/hooks/ignored-transition.d.ts +1 -0
- package/types/router/hooks/invalid-transition.d.ts +1 -0
- package/types/router/hooks/lazy-load.d.ts +42 -0
- package/types/router/hooks/on-enter-exit-retain.d.ts +3 -0
- package/types/router/hooks/redirect-to.d.ts +4 -0
- package/types/router/hooks/resolve.d.ts +4 -0
- package/types/router/hooks/update-globals.d.ts +1 -0
- package/types/router/hooks/url.d.ts +5 -0
- package/types/router/hooks/views.d.ts +5 -0
- package/types/router/index.d.ts +1 -17
- package/types/router/injectables.d.ts +1 -0
- package/types/router/params/param-factory.d.ts +8 -0
- package/types/router/params/param-type.d.ts +65 -0
- package/types/router/params/param-types.d.ts +36 -0
- package/types/router/params/param.d.ts +41 -0
- package/types/router/params/state-params.d.ts +12 -0
- package/types/router/path/path-node.d.ts +45 -0
- package/types/router/path/path-utils.d.ts +83 -0
- package/types/router/resolve/resolvable.d.ts +50 -0
- package/types/router/resolve/resolve-context.d.ts +102 -0
- package/types/router/services.d.ts +12 -13
- package/types/router/state/state-builder.d.ts +89 -0
- package/types/router/state/state-matcher.d.ts +7 -0
- package/types/router/state/state-object.d.ts +72 -0
- package/types/router/state/state-queue-manager.d.ts +19 -0
- package/types/router/state/state-registry.d.ts +118 -0
- package/types/router/state/state-service.d.ts +419 -0
- package/types/router/state/target-state.d.ts +102 -0
- package/types/router/state/views.d.ts +50 -0
- package/types/router/state-filters.d.ts +15 -0
- package/types/router/state-provider.d.ts +123 -0
- package/types/router/template-factory.d.ts +124 -0
- package/types/router/transition/hook-builder.d.ts +40 -0
- package/types/router/transition/hook-registry.d.ts +102 -0
- package/types/router/transition/interface.d.ts +11 -0
- package/types/router/transition/reject-factory.d.ts +42 -0
- package/types/router/transition/transition-event-type.d.ts +24 -0
- package/types/router/transition/transition-hook.d.ts +86 -0
- package/types/router/transition/transition-service.d.ts +115 -0
- package/types/router/transition/transition.d.ts +390 -0
- package/types/router/url/url-config.d.ts +100 -0
- package/types/router/url/url-matcher.d.ts +175 -0
- package/types/router/url/url-rule.d.ts +146 -0
- package/types/router/url/url-rules.d.ts +229 -0
- package/types/router/url/url-service.d.ts +278 -0
- package/types/router/view/view.d.ts +137 -0
- package/types/router/view-scroll.d.ts +5 -0
- package/types/services/anchor-scroll.d.ts +11 -0
- package/types/services/browser.d.ts +150 -0
- package/types/services/cache-factory.d.ts +143 -0
- package/types/services/cookie-reader.d.ts +17 -0
- package/types/services/document.d.ts +38 -0
- package/types/services/http-backend.d.ts +78 -0
- package/types/services/http.d.ts +157 -0
- package/types/services/log.d.ts +63 -0
- package/types/services/template-request.d.ts +69 -0
- package/types/shared/common.d.ts +216 -0
- package/types/shared/hof.d.ts +131 -0
- package/types/shared/predicates.d.ts +15 -0
- package/types/shared/strings.d.ts +55 -0
- package/types/shared/utils.d.ts +630 -0
- package/types-back/README.md +2 -0
- package/{types → types-back}/index.d.ts +17 -12
- package/types-back/router/index.d.ts +17 -0
- package/types-back/router/services.d.ts +15 -0
- package/e2e/unit.spec.ts +0 -16
- package/public/my_other_directive.html +0 -1
- package/src/directive/if.md +0 -80
- package/test/build-test.html +0 -14
- package/test/mock-test.html +0 -13
- package/test/module-test.html +0 -58
- /package/{test → public}/jasmine/jasmine-5.1.2/boot0.js +0 -0
- /package/{test → public}/jasmine/jasmine-5.1.2/boot1.js +0 -0
- /package/{test → public}/jasmine/jasmine-5.1.2/jasmine-html.js +0 -0
- /package/{test → public}/jasmine/jasmine-5.1.2/jasmine.css +0 -0
- /package/{test → public}/jasmine/jasmine-5.1.2/jasmine.js +0 -0
- /package/{test → public}/jasmine/jasmine-5.1.2/jasmine_favicon.png +0 -0
- /package/{test → public}/jasmine/jasmine-browser.json +0 -0
- /package/{test → public}/jasmine/jasmine.json +0 -0
- /package/public/{README.md → public/README.md} +0 -0
- /package/public/{circle.html → public/circle.html} +0 -0
- /package/public/{my_child_directive.html → public/my_child_directive.html} +0 -0
- /package/public/{my_directive.html → public/my_directive.html} +0 -0
- /package/public/{test.html → public/test.html} +0 -0
- /package/src/core/{animate-css.js → animate/animate-css.js} +0 -0
- /package/src/core/{cache.js → cache/cache.js} +0 -0
- /package/src/core/{compile.md → compile/compile.md} +0 -0
- /package/src/core/{filter.md → filter/filter.md} +0 -0
- /package/src/core/{interval.md → interval/interval.md} +0 -0
- /package/src/core/{pubsub.js → pubsub/pubsub.js} +0 -0
- /package/src/directive/{bind.md → bind/bind.md} +0 -0
- /package/src/directive/{change.js → change/change.js} +0 -0
- /package/src/directive/{change.md → change/change.md} +0 -0
- /package/src/directive/{cloak.js → cloak/cloak.js} +0 -0
- /package/src/directive/{cloak.md → cloak/cloak.md} +0 -0
- /package/src/directive/{controller.js → controller/controller.js} +0 -0
- /package/src/directive/{controller.md → controller/controller.md} +0 -0
- /package/src/directive/{events.md → events/events.md} +0 -0
- /package/src/directive/{include.md → include/include.md} +0 -0
- /package/src/directive/{init.js → init/init.js} +0 -0
- /package/src/directive/{init.md → init/init.md} +0 -0
- /package/src/directive/{list.md → list/list.md} +0 -0
- /package/src/directive/{non-bindable.js → non-bindable/non-bindable.js} +0 -0
- /package/src/directive/{non-bindable.md → non-bindable/non-bindable.md} +0 -0
- /package/src/directive/{repeat.md → repeat/repeat.md} +0 -0
- /package/src/directive/{script.js → script/script.js} +0 -0
- /package/src/directive/{show-hide.js → show-hide/show-hide.js} +0 -0
- /package/src/directive/{style.js → style/style.js} +0 -0
- /package/src/directive/{style.md → style/style.md} +0 -0
- /package/src/directive/{switch.md → switch/switch.md} +0 -0
- /package/src/exts/{messages.md → messages/messages.md} +0 -0
- /package/{test/module-test.js → src/services/http/http.html} +0 -0
- /package/src/{constants.js → shared/constants.js} +0 -0
- /package/{types → types-back}/angular.d.ts +0 -0
- /package/{types → types-back}/global.d.ts +0 -0
- /package/{types → types-back}/jqlite.d.ts +0 -0
- /package/{types → types-back}/router/core/common/common.d.ts +0 -0
- /package/{types → types-back}/router/core/common/coreservices.d.ts +0 -0
- /package/{types → types-back}/router/core/common/glob.d.ts +0 -0
- /package/{types → types-back}/router/core/common/hof.d.ts +0 -0
- /package/{types → types-back}/router/core/common/index.d.ts +0 -0
- /package/{types → types-back}/router/core/common/predicates.d.ts +0 -0
- /package/{types → types-back}/router/core/common/queue.d.ts +0 -0
- /package/{types → types-back}/router/core/common/safeConsole.d.ts +0 -0
- /package/{types → types-back}/router/core/common/strings.d.ts +0 -0
- /package/{types → types-back}/router/core/common/trace.d.ts +0 -0
- /package/{types → types-back}/router/core/globals.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/coreResolvables.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/ignoredTransition.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/invalidTransition.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/lazyLoad.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/onEnterExitRetain.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/redirectTo.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/resolve.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/updateGlobals.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/url.d.ts +0 -0
- /package/{types → types-back}/router/core/hooks/views.d.ts +0 -0
- /package/{types → types-back}/router/core/index.d.ts +0 -0
- /package/{types → types-back}/router/core/interface.d.ts +0 -0
- /package/{types → types-back}/router/core/params/index.d.ts +0 -0
- /package/{types → types-back}/router/core/params/interface.d.ts +0 -0
- /package/{types → types-back}/router/core/params/param.d.ts +0 -0
- /package/{types → types-back}/router/core/params/paramType.d.ts +0 -0
- /package/{types → types-back}/router/core/params/paramTypes.d.ts +0 -0
- /package/{types → types-back}/router/core/params/stateParams.d.ts +0 -0
- /package/{types → types-back}/router/core/path/index.d.ts +0 -0
- /package/{types → types-back}/router/core/path/pathNode.d.ts +0 -0
- /package/{types → types-back}/router/core/path/pathUtils.d.ts +0 -0
- /package/{types → types-back}/router/core/resolve/index.d.ts +0 -0
- /package/{types → types-back}/router/core/resolve/interface.d.ts +0 -0
- /package/{types → types-back}/router/core/resolve/resolvable.d.ts +0 -0
- /package/{types → types-back}/router/core/resolve/resolveContext.d.ts +0 -0
- /package/{types → types-back}/router/core/router.d.ts +0 -0
- /package/{types → types-back}/router/core/state/index.d.ts +0 -0
- /package/{types → types-back}/router/core/state/interface.d.ts +0 -0
- /package/{types → types-back}/router/core/state/stateBuilder.d.ts +0 -0
- /package/{types → types-back}/router/core/state/stateMatcher.d.ts +0 -0
- /package/{types → types-back}/router/core/state/stateObject.d.ts +0 -0
- /package/{types → types-back}/router/core/state/stateQueueManager.d.ts +0 -0
- /package/{types → types-back}/router/core/state/stateRegistry.d.ts +0 -0
- /package/{types → types-back}/router/core/state/stateService.d.ts +0 -0
- /package/{types → types-back}/router/core/state/targetState.d.ts +0 -0
- /package/{types → types-back}/router/core/transition/hookBuilder.d.ts +0 -0
- /package/{types → types-back}/router/core/transition/hookRegistry.d.ts +0 -0
- /package/{types → types-back}/router/core/transition/index.d.ts +0 -0
- /package/{types → types-back}/router/core/transition/interface.d.ts +0 -0
- /package/{types → types-back}/router/core/transition/rejectFactory.d.ts +0 -0
- /package/{types → types-back}/router/core/transition/transition.d.ts +0 -0
- /package/{types → types-back}/router/core/transition/transitionEventType.d.ts +0 -0
- /package/{types → types-back}/router/core/transition/transitionHook.d.ts +0 -0
- /package/{types → types-back}/router/core/transition/transitionService.d.ts +0 -0
- /package/{types → types-back}/router/core/url/index.d.ts +0 -0
- /package/{types → types-back}/router/core/url/interface.d.ts +0 -0
- /package/{types → types-back}/router/core/url/urlConfig.d.ts +0 -0
- /package/{types → types-back}/router/core/url/urlMatcher.d.ts +0 -0
- /package/{types → types-back}/router/core/url/urlMatcherFactory.d.ts +0 -0
- /package/{types → types-back}/router/core/url/urlRouter.d.ts +0 -0
- /package/{types → types-back}/router/core/url/urlRule.d.ts +0 -0
- /package/{types → types-back}/router/core/url/urlRules.d.ts +0 -0
- /package/{types → types-back}/router/core/url/urlService.d.ts +0 -0
- /package/{types → types-back}/router/core/view/index.d.ts +0 -0
- /package/{types → types-back}/router/core/view/interface.d.ts +0 -0
- /package/{types → types-back}/router/core/view/view.d.ts +0 -0
- /package/{types → types-back}/router/directives/viewDirective.d.ts +0 -0
- /package/{types → types-back}/router/interface.d.ts +0 -0
- /package/{types → types-back}/router/legacy/resolveService.d.ts +0 -0
- /package/{types → types-back}/router/legacy/stateEvents.d.ts +0 -0
- /package/{types → types-back}/router/stateFilters.d.ts +0 -0
- /package/{types → types-back}/router/stateProvider.d.ts +0 -0
- /package/{types → types-back}/router/statebuilders/onEnterExitRetain.d.ts +0 -0
- /package/{types → types-back}/router/statebuilders/views.d.ts +0 -0
- /package/{types → types-back}/router/templateFactory.d.ts +0 -0
- /package/{types → types-back}/router/viewScroll.d.ts +0 -0
- /package/{test/server → utils}/express.js +0 -0
|
@@ -0,0 +1,672 @@
|
|
|
1
|
+
export function NgModelController(
|
|
2
|
+
$scope: any,
|
|
3
|
+
$exceptionHandler: any,
|
|
4
|
+
$attr: any,
|
|
5
|
+
$element: any,
|
|
6
|
+
$parse: any,
|
|
7
|
+
$animate: any,
|
|
8
|
+
$timeout: any,
|
|
9
|
+
$q: any,
|
|
10
|
+
$interpolate: any,
|
|
11
|
+
): void;
|
|
12
|
+
export class NgModelController {
|
|
13
|
+
constructor(
|
|
14
|
+
$scope: any,
|
|
15
|
+
$exceptionHandler: any,
|
|
16
|
+
$attr: any,
|
|
17
|
+
$element: any,
|
|
18
|
+
$parse: any,
|
|
19
|
+
$animate: any,
|
|
20
|
+
$timeout: any,
|
|
21
|
+
$q: any,
|
|
22
|
+
$interpolate: any,
|
|
23
|
+
);
|
|
24
|
+
$viewValue: number;
|
|
25
|
+
$modelValue: number;
|
|
26
|
+
$$rawModelValue: any;
|
|
27
|
+
$validators: {};
|
|
28
|
+
$asyncValidators: {};
|
|
29
|
+
$parsers: any[];
|
|
30
|
+
$formatters: any[];
|
|
31
|
+
$viewChangeListeners: any[];
|
|
32
|
+
$untouched: boolean;
|
|
33
|
+
$touched: boolean;
|
|
34
|
+
$pristine: boolean;
|
|
35
|
+
$dirty: boolean;
|
|
36
|
+
$valid: boolean;
|
|
37
|
+
$invalid: boolean;
|
|
38
|
+
$error: {};
|
|
39
|
+
$$success: {};
|
|
40
|
+
$pending: any;
|
|
41
|
+
$name: any;
|
|
42
|
+
$$parentForm: {
|
|
43
|
+
$addControl: () => void;
|
|
44
|
+
$getControls: () => any;
|
|
45
|
+
$$renameControl: (control: any, name: any) => void;
|
|
46
|
+
$removeControl: () => void;
|
|
47
|
+
$setValidity: () => void;
|
|
48
|
+
$setDirty: () => void;
|
|
49
|
+
$setPristine: () => void;
|
|
50
|
+
$setSubmitted: () => void;
|
|
51
|
+
$$setSubmitted: () => void;
|
|
52
|
+
};
|
|
53
|
+
$options: any;
|
|
54
|
+
$$updateEvents: string;
|
|
55
|
+
$$updateEventHandler: any;
|
|
56
|
+
$$parsedNgModel: any;
|
|
57
|
+
$$parsedNgModelAssign: any;
|
|
58
|
+
$$ngModelGet: any;
|
|
59
|
+
$$ngModelSet: any;
|
|
60
|
+
$$pendingDebounce: any;
|
|
61
|
+
$$parserValid: boolean;
|
|
62
|
+
$$parserName: string;
|
|
63
|
+
$$currentValidationRunId: number;
|
|
64
|
+
$$scope: any;
|
|
65
|
+
$$rootScope: any;
|
|
66
|
+
$$attr: any;
|
|
67
|
+
$$element: any;
|
|
68
|
+
$$animate: any;
|
|
69
|
+
$$timeout: any;
|
|
70
|
+
$$parse: any;
|
|
71
|
+
$$q: any;
|
|
72
|
+
$$exceptionHandler: any;
|
|
73
|
+
$$initGetterSetters(): void;
|
|
74
|
+
$render: () => void;
|
|
75
|
+
/**
|
|
76
|
+
* @ngdoc method
|
|
77
|
+
* @name ngModel.NgModelController#$isEmpty
|
|
78
|
+
*
|
|
79
|
+
* @description
|
|
80
|
+
* This is called when we need to determine if the value of an input is empty.
|
|
81
|
+
*
|
|
82
|
+
* For instance, the required directive does this to work out if the input has data or not.
|
|
83
|
+
*
|
|
84
|
+
* The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.
|
|
85
|
+
*
|
|
86
|
+
* You can override this for input directives whose concept of being empty is different from the
|
|
87
|
+
* default. The `checkboxInputType` directive does this because in its case a value of `false`
|
|
88
|
+
* implies empty.
|
|
89
|
+
*
|
|
90
|
+
* @param {*} value The value of the input to check for emptiness.
|
|
91
|
+
* @returns {boolean} True if `value` is "empty".
|
|
92
|
+
*/
|
|
93
|
+
$isEmpty(value: any): boolean;
|
|
94
|
+
$$updateEmptyClasses(value: any): void;
|
|
95
|
+
/**
|
|
96
|
+
* @ngdoc method
|
|
97
|
+
* @name ngModel.NgModelController#$setPristine
|
|
98
|
+
*
|
|
99
|
+
* @description
|
|
100
|
+
* Sets the control to its pristine state.
|
|
101
|
+
*
|
|
102
|
+
* This method can be called to remove the `ng-dirty` class and set the control to its pristine
|
|
103
|
+
* state (`ng-pristine` class). A model is considered to be pristine when the control
|
|
104
|
+
* has not been changed from when first compiled.
|
|
105
|
+
*/
|
|
106
|
+
$setPristine(): void;
|
|
107
|
+
/**
|
|
108
|
+
* @ngdoc method
|
|
109
|
+
* @name ngModel.NgModelController#$setDirty
|
|
110
|
+
*
|
|
111
|
+
* @description
|
|
112
|
+
* Sets the control to its dirty state.
|
|
113
|
+
*
|
|
114
|
+
* This method can be called to remove the `ng-pristine` class and set the control to its dirty
|
|
115
|
+
* state (`ng-dirty` class). A model is considered to be dirty when the control has been changed
|
|
116
|
+
* from when first compiled.
|
|
117
|
+
*/
|
|
118
|
+
$setDirty(): void;
|
|
119
|
+
/**
|
|
120
|
+
* @ngdoc method
|
|
121
|
+
* @name ngModel.NgModelController#$setUntouched
|
|
122
|
+
*
|
|
123
|
+
* @description
|
|
124
|
+
* Sets the control to its untouched state.
|
|
125
|
+
*
|
|
126
|
+
* This method can be called to remove the `ng-touched` class and set the control to its
|
|
127
|
+
* untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched
|
|
128
|
+
* by default, however this function can be used to restore that state if the model has
|
|
129
|
+
* already been touched by the user.
|
|
130
|
+
*/
|
|
131
|
+
$setUntouched(): void;
|
|
132
|
+
/**
|
|
133
|
+
* @ngdoc method
|
|
134
|
+
* @name ngModel.NgModelController#$setTouched
|
|
135
|
+
*
|
|
136
|
+
* @description
|
|
137
|
+
* Sets the control to its touched state.
|
|
138
|
+
*
|
|
139
|
+
* This method can be called to remove the `ng-untouched` class and set the control to its
|
|
140
|
+
* touched state (`ng-touched` class). A model is considered to be touched when the user has
|
|
141
|
+
* first focused the control element and then shifted focus away from the control (blur event).
|
|
142
|
+
*/
|
|
143
|
+
$setTouched(): void;
|
|
144
|
+
/**
|
|
145
|
+
* @ngdoc method
|
|
146
|
+
* @name ngModel.NgModelController#$rollbackViewValue
|
|
147
|
+
*
|
|
148
|
+
* @description
|
|
149
|
+
* Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,
|
|
150
|
+
* which may be caused by a pending debounced event or because the input is waiting for some
|
|
151
|
+
* future event.
|
|
152
|
+
*
|
|
153
|
+
* If you have an input that uses `ng-model-options` to set up debounced updates or updates that
|
|
154
|
+
* depend on special events such as `blur`, there can be a period when the `$viewValue` is out of
|
|
155
|
+
* sync with the ngModel's `$modelValue`.
|
|
156
|
+
*
|
|
157
|
+
* In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update
|
|
158
|
+
* and reset the input to the last committed view value.
|
|
159
|
+
*
|
|
160
|
+
* It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue`
|
|
161
|
+
* programmatically before these debounced/future events have resolved/occurred, because AngularJS's
|
|
162
|
+
* dirty checking mechanism is not able to tell whether the model has actually changed or not.
|
|
163
|
+
*
|
|
164
|
+
* The `$rollbackViewValue()` method should be called before programmatically changing the model of an
|
|
165
|
+
* input which may have such events pending. This is important in order to make sure that the
|
|
166
|
+
* input field will be updated with the new model value and any pending operations are cancelled.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* <example name="ng-model-cancel-update" module="cancel-update-example">
|
|
170
|
+
* <file name="app.js">
|
|
171
|
+
* angular.module('cancel-update-example', [])
|
|
172
|
+
*
|
|
173
|
+
* .controller('CancelUpdateController', ['$scope', function($scope) {
|
|
174
|
+
* $scope.model = {value1: '', value2: ''};
|
|
175
|
+
*
|
|
176
|
+
* $scope.setEmpty = function(e, value, rollback) {
|
|
177
|
+
* if (e.keyCode === 27) {
|
|
178
|
+
* e.preventDefault();
|
|
179
|
+
* if (rollback) {
|
|
180
|
+
* $scope.myForm[value].$rollbackViewValue();
|
|
181
|
+
* }
|
|
182
|
+
* $scope.model[value] = '';
|
|
183
|
+
* }
|
|
184
|
+
* };
|
|
185
|
+
* }]);
|
|
186
|
+
* </file>
|
|
187
|
+
* <file name="index.html">
|
|
188
|
+
* <div ng-controller="CancelUpdateController">
|
|
189
|
+
* <p>Both of these inputs are only updated if they are blurred. Hitting escape should
|
|
190
|
+
* empty them. Follow these steps and observe the difference:</p>
|
|
191
|
+
* <ol>
|
|
192
|
+
* <li>Type something in the input. You will see that the model is not yet updated</li>
|
|
193
|
+
* <li>Press the Escape key.
|
|
194
|
+
* <ol>
|
|
195
|
+
* <li> In the first example, nothing happens, because the model is already '', and no
|
|
196
|
+
* update is detected. If you blur the input, the model will be set to the current view.
|
|
197
|
+
* </li>
|
|
198
|
+
* <li> In the second example, the pending update is cancelled, and the input is set back
|
|
199
|
+
* to the last committed view value (''). Blurring the input does nothing.
|
|
200
|
+
* </li>
|
|
201
|
+
* </ol>
|
|
202
|
+
* </li>
|
|
203
|
+
* </ol>
|
|
204
|
+
*
|
|
205
|
+
* <form name="myForm" ng-model-options="{ updateOn: 'blur' }">
|
|
206
|
+
* <div>
|
|
207
|
+
* <p id="inputDescription1">Without $rollbackViewValue():</p>
|
|
208
|
+
* <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
|
|
209
|
+
* ng-keydown="setEmpty($event, 'value1')">
|
|
210
|
+
* value1: "{{ model.value1 }}"
|
|
211
|
+
* </div>
|
|
212
|
+
*
|
|
213
|
+
* <div>
|
|
214
|
+
* <p id="inputDescription2">With $rollbackViewValue():</p>
|
|
215
|
+
* <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
|
|
216
|
+
* ng-keydown="setEmpty($event, 'value2', true)">
|
|
217
|
+
* value2: "{{ model.value2 }}"
|
|
218
|
+
* </div>
|
|
219
|
+
* </form>
|
|
220
|
+
* </div>
|
|
221
|
+
* </file>
|
|
222
|
+
<file name="style.css">
|
|
223
|
+
div {
|
|
224
|
+
display: table-cell;
|
|
225
|
+
}
|
|
226
|
+
div:nth-child(1) {
|
|
227
|
+
padding-right: 30px;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
</file>
|
|
231
|
+
* </example>
|
|
232
|
+
*/
|
|
233
|
+
$rollbackViewValue(): void;
|
|
234
|
+
/**
|
|
235
|
+
* @ngdoc method
|
|
236
|
+
* @name ngModel.NgModelController#$validate
|
|
237
|
+
*
|
|
238
|
+
* @description
|
|
239
|
+
* Runs each of the registered validators (first synchronous validators and then
|
|
240
|
+
* asynchronous validators).
|
|
241
|
+
* If the validity changes to invalid, the model will be set to `undefined`,
|
|
242
|
+
* unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
|
|
243
|
+
* If the validity changes to valid, it will set the model to the last available valid
|
|
244
|
+
* `$modelValue`, i.e. either the last parsed value or the last value set from the scope.
|
|
245
|
+
*/
|
|
246
|
+
$validate(): void;
|
|
247
|
+
$$runValidators(modelValue: any, viewValue: any, doneCallback: any): void;
|
|
248
|
+
/**
|
|
249
|
+
* @ngdoc method
|
|
250
|
+
* @name ngModel.NgModelController#$commitViewValue
|
|
251
|
+
*
|
|
252
|
+
* @description
|
|
253
|
+
* Commit a pending update to the `$modelValue`.
|
|
254
|
+
*
|
|
255
|
+
* Updates may be pending by a debounced event or because the input is waiting for a some future
|
|
256
|
+
* event defined in `ng-model-options`. this method is rarely needed as `NgModelController`
|
|
257
|
+
* usually handles calling this in response to input events.
|
|
258
|
+
*/
|
|
259
|
+
$commitViewValue(): void;
|
|
260
|
+
$$lastCommittedViewValue: any;
|
|
261
|
+
$$parseAndValidate(): void;
|
|
262
|
+
$$writeModelToScope(): void;
|
|
263
|
+
/**
|
|
264
|
+
* @ngdoc method
|
|
265
|
+
* @name ngModel.NgModelController#$setViewValue
|
|
266
|
+
*
|
|
267
|
+
* @description
|
|
268
|
+
* Update the view value.
|
|
269
|
+
*
|
|
270
|
+
* This method should be called when a control wants to change the view value; typically,
|
|
271
|
+
* this is done from within a DOM event handler. For example, the {@link ng.directive:input input}
|
|
272
|
+
* directive calls it when the value of the input changes and {@link ng.directive:select select}
|
|
273
|
+
* calls it when an option is selected.
|
|
274
|
+
*
|
|
275
|
+
* When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`
|
|
276
|
+
* and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged
|
|
277
|
+
* value is sent directly for processing through the `$parsers` pipeline. After this, the `$validators` and
|
|
278
|
+
* `$asyncValidators` are called and the value is applied to `$modelValue`.
|
|
279
|
+
* Finally, the value is set to the **expression** specified in the `ng-model` attribute and
|
|
280
|
+
* all the registered change listeners, in the `$viewChangeListeners` list are called.
|
|
281
|
+
*
|
|
282
|
+
* In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`
|
|
283
|
+
* and the `default` trigger is not listed, all those actions will remain pending until one of the
|
|
284
|
+
* `updateOn` events is triggered on the DOM element.
|
|
285
|
+
* All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions}
|
|
286
|
+
* directive is used with a custom debounce for this particular event.
|
|
287
|
+
* Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce`
|
|
288
|
+
* is specified, once the timer runs out.
|
|
289
|
+
*
|
|
290
|
+
* When used with standard inputs, the view value will always be a string (which is in some cases
|
|
291
|
+
* parsed into another type, such as a `Date` object for `input[date]`.)
|
|
292
|
+
* However, custom controls might also pass objects to this method. In this case, we should make
|
|
293
|
+
* a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not
|
|
294
|
+
* perform a deep watch of objects, it only looks for a change of identity. If you only change
|
|
295
|
+
* the property of the object then ngModel will not realize that the object has changed and
|
|
296
|
+
* will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should
|
|
297
|
+
* not change properties of the copy once it has been passed to `$setViewValue`.
|
|
298
|
+
* Otherwise you may cause the model value on the scope to change incorrectly.
|
|
299
|
+
*
|
|
300
|
+
* <div class="alert alert-info">
|
|
301
|
+
* In any case, the value passed to the method should always reflect the current value
|
|
302
|
+
* of the control. For example, if you are calling `$setViewValue` for an input element,
|
|
303
|
+
* you should pass the input DOM value. Otherwise, the control and the scope model become
|
|
304
|
+
* out of sync. It's also important to note that `$setViewValue` does not call `$render` or change
|
|
305
|
+
* the control's DOM value in any way. If we want to change the control's DOM value
|
|
306
|
+
* programmatically, we should update the `ngModel` scope expression. Its new value will be
|
|
307
|
+
* picked up by the model controller, which will run it through the `$formatters`, `$render` it
|
|
308
|
+
* to update the DOM, and finally call `$validate` on it.
|
|
309
|
+
* </div>
|
|
310
|
+
*
|
|
311
|
+
* @param {*} value value from the view.
|
|
312
|
+
* @param {string} trigger Event that triggered the update.
|
|
313
|
+
*/
|
|
314
|
+
$setViewValue(value: any, trigger: string): void;
|
|
315
|
+
$$debounceViewValueCommit(trigger: any): void;
|
|
316
|
+
/**
|
|
317
|
+
* @ngdoc method
|
|
318
|
+
*
|
|
319
|
+
* @name ngModel.NgModelController#$overrideModelOptions
|
|
320
|
+
*
|
|
321
|
+
* @description
|
|
322
|
+
*
|
|
323
|
+
* Override the current model options settings programmatically.
|
|
324
|
+
*
|
|
325
|
+
* The previous `ModelOptions` value will not be modified. Instead, a
|
|
326
|
+
* new `ModelOptions` object will inherit from the previous one overriding
|
|
327
|
+
* or inheriting settings that are defined in the given parameter.
|
|
328
|
+
*
|
|
329
|
+
* See {@link ngModelOptions} for information about what options can be specified
|
|
330
|
+
* and how model option inheritance works.
|
|
331
|
+
*
|
|
332
|
+
* <div class="alert alert-warning">
|
|
333
|
+
* **Note:** this function only affects the options set on the `ngModelController`,
|
|
334
|
+
* and not the options on the {@link ngModelOptions} directive from which they might have been
|
|
335
|
+
* obtained initially.
|
|
336
|
+
* </div>
|
|
337
|
+
*
|
|
338
|
+
* <div class="alert alert-danger">
|
|
339
|
+
* **Note:** it is not possible to override the `getterSetter` option.
|
|
340
|
+
* </div>
|
|
341
|
+
*
|
|
342
|
+
* @param {Object} options a hash of settings to override the previous options
|
|
343
|
+
*
|
|
344
|
+
*/
|
|
345
|
+
$overrideModelOptions(options: any): void;
|
|
346
|
+
/**
|
|
347
|
+
* @ngdoc method
|
|
348
|
+
*
|
|
349
|
+
* @name ngModel.NgModelController#$processModelValue
|
|
350
|
+
|
|
351
|
+
* @description
|
|
352
|
+
*
|
|
353
|
+
* Runs the model -> view pipeline on the current
|
|
354
|
+
* {@link ngModel.NgModelController#$modelValue $modelValue}.
|
|
355
|
+
*
|
|
356
|
+
* The following actions are performed by this method:
|
|
357
|
+
*
|
|
358
|
+
* - the `$modelValue` is run through the {@link ngModel.NgModelController#$formatters $formatters}
|
|
359
|
+
* and the result is set to the {@link ngModel.NgModelController#$viewValue $viewValue}
|
|
360
|
+
* - the `ng-empty` or `ng-not-empty` class is set on the element
|
|
361
|
+
* - if the `$viewValue` has changed:
|
|
362
|
+
* - {@link ngModel.NgModelController#$render $render} is called on the control
|
|
363
|
+
* - the {@link ngModel.NgModelController#$validators $validators} are run and
|
|
364
|
+
* the validation status is set.
|
|
365
|
+
*
|
|
366
|
+
* This method is called by ngModel internally when the bound scope value changes.
|
|
367
|
+
* Application developers usually do not have to call this function themselves.
|
|
368
|
+
*
|
|
369
|
+
* This function can be used when the `$viewValue` or the rendered DOM value are not correctly
|
|
370
|
+
* formatted and the `$modelValue` must be run through the `$formatters` again.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* Consider a text input with an autocomplete list (for fruit), where the items are
|
|
374
|
+
* objects with a name and an id.
|
|
375
|
+
* A user enters `ap` and then selects `Apricot` from the list.
|
|
376
|
+
* Based on this, the autocomplete widget will call `$setViewValue({name: 'Apricot', id: 443})`,
|
|
377
|
+
* but the rendered value will still be `ap`.
|
|
378
|
+
* The widget can then call `ctrl.$processModelValue()` to run the model -> view
|
|
379
|
+
* pipeline again, which formats the object to the string `Apricot`,
|
|
380
|
+
* then updates the `$viewValue`, and finally renders it in the DOM.
|
|
381
|
+
*
|
|
382
|
+
* <example module="inputExample" name="ng-model-process">
|
|
383
|
+
<file name="index.html">
|
|
384
|
+
<div ng-controller="inputController" style="display: flex;">
|
|
385
|
+
<div style="margin-right: 30px;">
|
|
386
|
+
Search Fruit:
|
|
387
|
+
<basic-autocomplete items="items" on-select="selectedFruit = item"></basic-autocomplete>
|
|
388
|
+
</div>
|
|
389
|
+
<div>
|
|
390
|
+
Model:<br>
|
|
391
|
+
<pre>{{selectedFruit | json}}</pre>
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
</file>
|
|
395
|
+
<file name="app.js">
|
|
396
|
+
angular.module('inputExample', [])
|
|
397
|
+
.controller('inputController', function($scope) {
|
|
398
|
+
$scope.items = [
|
|
399
|
+
{name: 'Apricot', id: 443},
|
|
400
|
+
{name: 'Clementine', id: 972},
|
|
401
|
+
{name: 'Durian', id: 169},
|
|
402
|
+
{name: 'Jackfruit', id: 982},
|
|
403
|
+
{name: 'Strawberry', id: 863}
|
|
404
|
+
];
|
|
405
|
+
})
|
|
406
|
+
.component('basicAutocomplete', {
|
|
407
|
+
bindings: {
|
|
408
|
+
items: '<',
|
|
409
|
+
onSelect: '&'
|
|
410
|
+
},
|
|
411
|
+
templateUrl: 'autocomplete.html',
|
|
412
|
+
controller: function($element, $scope) {
|
|
413
|
+
let that = this;
|
|
414
|
+
let ngModel;
|
|
415
|
+
|
|
416
|
+
that.$postLink = function() {
|
|
417
|
+
ngModel = $element.find('input').controller('ngModel');
|
|
418
|
+
|
|
419
|
+
ngModel.$formatters.push(function(value) {
|
|
420
|
+
return (value && value.name) || value;
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
ngModel.$parsers.push(function(value) {
|
|
424
|
+
let match = value;
|
|
425
|
+
for (let i = 0; i < that.items.length; i++) {
|
|
426
|
+
if (that.items[i].name === value) {
|
|
427
|
+
match = that.items[i];
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return match;
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
that.selectItem = function(item) {
|
|
437
|
+
ngModel.$setViewValue(item);
|
|
438
|
+
ngModel.$processModelValue();
|
|
439
|
+
that.onSelect({item: item});
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
</file>
|
|
444
|
+
<file name="autocomplete.html">
|
|
445
|
+
<div>
|
|
446
|
+
<input type="search" ng-model="$ctrl.searchTerm" />
|
|
447
|
+
<ul>
|
|
448
|
+
<li ng-repeat="item in $ctrl.items | filter:$ctrl.searchTerm">
|
|
449
|
+
<button ng-click="$ctrl.selectItem(item)">{{ item.name }}</button>
|
|
450
|
+
</li>
|
|
451
|
+
</ul>
|
|
452
|
+
</div>
|
|
453
|
+
</file>
|
|
454
|
+
* </example>
|
|
455
|
+
*
|
|
456
|
+
*/
|
|
457
|
+
$processModelValue(): void;
|
|
458
|
+
/**
|
|
459
|
+
* This method is called internally to run the $formatters on the $modelValue
|
|
460
|
+
*/
|
|
461
|
+
$$format(): number;
|
|
462
|
+
/**
|
|
463
|
+
* This method is called internally when the bound scope value changes.
|
|
464
|
+
*/
|
|
465
|
+
$$setModelValue(modelValue: any): void;
|
|
466
|
+
$$setUpdateOnEvents(): void;
|
|
467
|
+
}
|
|
468
|
+
export namespace NgModelController {
|
|
469
|
+
let $inject: string[];
|
|
470
|
+
}
|
|
471
|
+
export const ngModelMinErr: (...args: any[]) => Error;
|
|
472
|
+
/**
|
|
473
|
+
* @ngdoc directive
|
|
474
|
+
* @name ngModel
|
|
475
|
+
* @restrict A
|
|
476
|
+
* @priority 1
|
|
477
|
+
* @param {string} ngModel assignable {@link guide/expression Expression} to bind to.
|
|
478
|
+
*
|
|
479
|
+
* @description
|
|
480
|
+
* The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a
|
|
481
|
+
* property on the scope using {@link ngModel.NgModelController NgModelController},
|
|
482
|
+
* which is created and exposed by this directive.
|
|
483
|
+
*
|
|
484
|
+
* `ngModel` is responsible for:
|
|
485
|
+
*
|
|
486
|
+
* - Binding the view into the model, which other directives such as `input`, `textarea` or `select`
|
|
487
|
+
* require.
|
|
488
|
+
* - Providing validation behavior (i.e. required, number, email, url).
|
|
489
|
+
* - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).
|
|
490
|
+
* - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`,
|
|
491
|
+
* `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations.
|
|
492
|
+
* - Registering the control with its parent {@link ng.directive:form form}.
|
|
493
|
+
*
|
|
494
|
+
* Note: `ngModel` will try to bind to the property given by evaluating the expression on the
|
|
495
|
+
* current scope. If the property doesn't already exist on this scope, it will be created
|
|
496
|
+
* implicitly and added to the scope.
|
|
497
|
+
*
|
|
498
|
+
* For best practices on using `ngModel`, see:
|
|
499
|
+
*
|
|
500
|
+
* - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)
|
|
501
|
+
*
|
|
502
|
+
* For basic examples, how to use `ngModel`, see:
|
|
503
|
+
*
|
|
504
|
+
* - {@link ng.directive:input input}
|
|
505
|
+
* - {@link input[text] text}
|
|
506
|
+
* - {@link input[checkbox] checkbox}
|
|
507
|
+
* - {@link input[radio] radio}
|
|
508
|
+
* - {@link input[number] number}
|
|
509
|
+
* - {@link input[email] email}
|
|
510
|
+
* - {@link input[url] url}
|
|
511
|
+
* - {@link input[date] date}
|
|
512
|
+
* - {@link input[datetime-local] datetime-local}
|
|
513
|
+
* - {@link input[time] time}
|
|
514
|
+
* - {@link input[month] month}
|
|
515
|
+
* - {@link input[week] week}
|
|
516
|
+
* - {@link ng.directive:select select}
|
|
517
|
+
* - {@link ng.directive:textarea textarea}
|
|
518
|
+
*
|
|
519
|
+
* ## Complex Models (objects or collections)
|
|
520
|
+
*
|
|
521
|
+
* By default, `ngModel` watches the model by reference, not value. This is important to know when
|
|
522
|
+
* binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the
|
|
523
|
+
* object or collection change, `ngModel` will not be notified and so the input will not be re-rendered.
|
|
524
|
+
*
|
|
525
|
+
* The model must be assigned an entirely new object or collection before a re-rendering will occur.
|
|
526
|
+
*
|
|
527
|
+
* Some directives have options that will cause them to use a custom `$watchCollection` on the model expression
|
|
528
|
+
* - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or
|
|
529
|
+
* if the select is given the `multiple` attribute.
|
|
530
|
+
*
|
|
531
|
+
* The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the
|
|
532
|
+
* first level of the object (or only changing the properties of an item in the collection if it's an array) will still
|
|
533
|
+
* not trigger a re-rendering of the model.
|
|
534
|
+
*
|
|
535
|
+
* ## CSS classes
|
|
536
|
+
* The following CSS classes are added and removed on the associated input/select/textarea element
|
|
537
|
+
* depending on the validity of the model.
|
|
538
|
+
*
|
|
539
|
+
* - `ng-valid`: the model is valid
|
|
540
|
+
* - `ng-invalid`: the model is invalid
|
|
541
|
+
* - `ng-valid-[key]`: for each valid key added by `$setValidity`
|
|
542
|
+
* - `ng-invalid-[key]`: for each invalid key added by `$setValidity`
|
|
543
|
+
* - `ng-pristine`: the control hasn't been interacted with yet
|
|
544
|
+
* - `ng-dirty`: the control has been interacted with
|
|
545
|
+
* - `ng-touched`: the control has been blurred
|
|
546
|
+
* - `ng-untouched`: the control hasn't been blurred
|
|
547
|
+
* - `ng-pending`: any `$asyncValidators` are unfulfilled
|
|
548
|
+
* - `ng-empty`: the view does not contain a value or the value is deemed "empty", as defined
|
|
549
|
+
* by the {@link ngModel.NgModelController#$isEmpty} method
|
|
550
|
+
* - `ng-not-empty`: the view contains a non-empty value
|
|
551
|
+
*
|
|
552
|
+
* Keep in mind that ngAnimate can detect each of these classes when added and removed.
|
|
553
|
+
*
|
|
554
|
+
* @animations
|
|
555
|
+
* Animations within models are triggered when any of the associated CSS classes are added and removed
|
|
556
|
+
* on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`,
|
|
557
|
+
* `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.
|
|
558
|
+
* The animations that are triggered within ngModel are similar to how they work in ngClass and
|
|
559
|
+
* animations can be hooked into using CSS transitions, keyframes as well as JS animations.
|
|
560
|
+
*
|
|
561
|
+
* The following example shows a simple way to utilize CSS transitions to style an input element
|
|
562
|
+
* that has been rendered as invalid after it has been validated:
|
|
563
|
+
*
|
|
564
|
+
* <pre>
|
|
565
|
+
* //be sure to include ngAnimate as a module to hook into more
|
|
566
|
+
* //advanced animations
|
|
567
|
+
* .my-input {
|
|
568
|
+
* transition:0.5s linear all;
|
|
569
|
+
* background: white;
|
|
570
|
+
* }
|
|
571
|
+
* .my-input.ng-invalid {
|
|
572
|
+
* background: red;
|
|
573
|
+
* color:white;
|
|
574
|
+
* }
|
|
575
|
+
* </pre>
|
|
576
|
+
*
|
|
577
|
+
* @example
|
|
578
|
+
* ### Basic Usage
|
|
579
|
+
* <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample" name="ng-model">
|
|
580
|
+
<file name="index.html">
|
|
581
|
+
<script>
|
|
582
|
+
angular.module('inputExample', [])
|
|
583
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
|
584
|
+
$scope.val = '1';
|
|
585
|
+
}]);
|
|
586
|
+
</script>
|
|
587
|
+
<style>
|
|
588
|
+
.my-input {
|
|
589
|
+
transition:all linear 0.5s;
|
|
590
|
+
background: transparent;
|
|
591
|
+
}
|
|
592
|
+
.my-input.ng-invalid {
|
|
593
|
+
color:white;
|
|
594
|
+
background: red;
|
|
595
|
+
}
|
|
596
|
+
</style>
|
|
597
|
+
<p id="inputDescription">
|
|
598
|
+
Update input to see transitions when valid/invalid.
|
|
599
|
+
Integer is a valid value.
|
|
600
|
+
</p>
|
|
601
|
+
<form name="testForm" ng-controller="ExampleController">
|
|
602
|
+
<input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input"
|
|
603
|
+
aria-describedby="inputDescription" />
|
|
604
|
+
</form>
|
|
605
|
+
</file>
|
|
606
|
+
* </example>
|
|
607
|
+
*
|
|
608
|
+
* @example
|
|
609
|
+
* ### Binding to a getter/setter
|
|
610
|
+
*
|
|
611
|
+
* Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a
|
|
612
|
+
* function that returns a representation of the model when called with zero arguments, and sets
|
|
613
|
+
* the internal state of a model when called with an argument. It's sometimes useful to use this
|
|
614
|
+
* for models that have an internal representation that's different from what the model exposes
|
|
615
|
+
* to the view.
|
|
616
|
+
*
|
|
617
|
+
* <div class="alert alert-success">
|
|
618
|
+
* **Best Practice:** It's best to keep getters fast because AngularJS is likely to call them more
|
|
619
|
+
* frequently than other parts of your code.
|
|
620
|
+
* </div>
|
|
621
|
+
*
|
|
622
|
+
* You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that
|
|
623
|
+
* has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to
|
|
624
|
+
* a `<form>`, which will enable this behavior for all `<input>`s within it. See
|
|
625
|
+
* {@link ng.directive:ngModelOptions `ngModelOptions`} for more.
|
|
626
|
+
*
|
|
627
|
+
* The following example shows how to use `ngModel` with a getter/setter:
|
|
628
|
+
*
|
|
629
|
+
* @example
|
|
630
|
+
* <example name="ngModel-getter-setter" module="getterSetterExample">
|
|
631
|
+
<file name="index.html">
|
|
632
|
+
<div ng-controller="ExampleController">
|
|
633
|
+
<form name="userForm">
|
|
634
|
+
<label>Name:
|
|
635
|
+
<input type="text" name="userName"
|
|
636
|
+
ng-model="user.name"
|
|
637
|
+
ng-model-options="{ getterSetter: true }" />
|
|
638
|
+
</label>
|
|
639
|
+
</form>
|
|
640
|
+
<pre>user.name = <span ng-bind="user.name()"></span></pre>
|
|
641
|
+
</div>
|
|
642
|
+
</file>
|
|
643
|
+
<file name="app.js">
|
|
644
|
+
angular.module('getterSetterExample', [])
|
|
645
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
|
646
|
+
let _name = 'Brian';
|
|
647
|
+
$scope.user = {
|
|
648
|
+
name: function(newName) {
|
|
649
|
+
// Note that newName can be undefined for two reasons:
|
|
650
|
+
// 1. Because it is called as a getter and thus called with no arguments
|
|
651
|
+
// 2. Because the property should actually be set to undefined. This happens e.g. if the
|
|
652
|
+
// input is invalid
|
|
653
|
+
return arguments.length ? (_name = newName) : _name;
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
}]);
|
|
657
|
+
</file>
|
|
658
|
+
* </example>
|
|
659
|
+
*/
|
|
660
|
+
export const ngModelDirective: (
|
|
661
|
+
| string
|
|
662
|
+
| (($rootScope: any) => {
|
|
663
|
+
restrict: string;
|
|
664
|
+
require: string[];
|
|
665
|
+
controller: typeof NgModelController;
|
|
666
|
+
priority: number;
|
|
667
|
+
compile: (element: any) => {
|
|
668
|
+
pre: (scope: any, element: any, attr: any, ctrls: any) => void;
|
|
669
|
+
post: (scope: any, element: any, attr: any, ctrls: any) => void;
|
|
670
|
+
};
|
|
671
|
+
})
|
|
672
|
+
)[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const ngOptionsDirective: (
|
|
2
|
+
| string
|
|
3
|
+
| ((
|
|
4
|
+
$compile: any,
|
|
5
|
+
$document: any,
|
|
6
|
+
$parse: any,
|
|
7
|
+
) => {
|
|
8
|
+
restrict: string;
|
|
9
|
+
terminal: boolean;
|
|
10
|
+
require: string[];
|
|
11
|
+
link: {
|
|
12
|
+
pre: (scope: any, selectElement: any, attr: any, ctrls: any) => void;
|
|
13
|
+
post: (scope: any, selectElement: any, attr: any, ctrls: any) => void;
|
|
14
|
+
};
|
|
15
|
+
})
|
|
16
|
+
)[];
|