Package org.angular.ts.ng
Interface AngularService
@JsType(isNative=true,
name="ng.AngularService",
namespace="<global>")
public interface AngularService
Main AngularTS runtime entry point with the full built-in `ng` module configured by default.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptiondefault InjectorService<Object> Use this function to manually start up AngularTS application.default InjectorService<Object> Use this function to manually start up AngularTS application.default InjectorService<Object> Use this function to manually start up AngularTS application.bootstrap(AngularService.BootstrapElementUnionType element, elemental2.core.JsArray<Object> modules) Use this function to manually start up AngularTS application.elemental2.promise.Promise<Object> Await result.booleandispatchEvent(elemental2.dom.Event event) Dispatches an invocation event to either an injectable service or a named scope.voidFire-and-forget.Configure how values embedded in framework error messages are formatted.getController(elemental2.dom.Element element, String name) Retrieve the controller instance cached on a compiled DOM element.Application injector, available after `bootstrap()` or `injector()` completes.Application-wide event bus, available after bootstrap providers are created.getInjector(elemental2.dom.Element element) Retrieve the injector cached on a bootstrapped DOM element.getNormalizedAttr(Node element, String normalizedName) Read an element attribute by normalized directive-style name.getNormalizedAttrName(Node element, String normalizedName) Return the actual DOM attribute name for a normalized directive-style name.Root scope for the bootstrapped application.getScope(elemental2.dom.Element element) Retrieve the scope cached on a compiled DOM element.getScopeByName(String name) Find a scope by its registered `scopeName`.Base class for user-authored AngularTS custom elements.elemental2.core.JsArray<Object> Sub-application instances created when multiple `ng-app` roots are initialized.Public injection token names keyed by token value.AngularTS version string replaced at build time.getView()Explicit programmatic-view binding and element helpers.booleanhasNormalizedAttr(Node element, String normalizedName) Return whether an element has an attribute matching a normalized name.default voidinit(elemental2.dom.HTMLElement element) Find `ng-app` roots under the provided element and bootstrap them.default voidFind `ng-app` roots under the provided element and bootstrap them.voidinit(AngularService.InitElementUnionType element) Find `ng-app` roots under the provided element and bootstrap them.Create a standalone injector without bootstrapping the DOM.The `angular.module` is a global place for creating, registering and retrieving AngularTS modules.Registers the configured built-in `ng` module for this runtime instance.voidsetCurrentInjector(InjectorService<Object> currentInjector) Application injector, available after `bootstrap()` or `injector()` completes.voidsetEventBus(EventBusService eventBus) Application-wide event bus, available after bootstrap providers are created.voidsetRootScope(Scope rootScope) Root scope for the bootstrapped application.voidsetScopeElement(ScopeElement<Object> ScopeElement) Base class for user-authored AngularTS custom elements.voidsetSubapps(elemental2.core.JsArray<Object> subapps) Sub-application instances created when multiple `ng-app` roots are initialized.voidPublic injection token names keyed by token value.voidsetVersion(String version) AngularTS version string replaced at build time.voidExplicit programmatic-view binding and element helpers.JSX-free real-DOM tag factories for programmatic component views.
-
Method Details
-
bootstrap
InjectorService<Object> bootstrap(AngularService.BootstrapElementUnionType element, elemental2.core.JsArray<Object> modules) Use this function to manually start up AngularTS application. AngularTS will detect if it has been loaded into the browser more than once and only allow the first loaded script to be bootstrapped and will report a warning to the browser console for each of the subsequent scripts. This prevents strange results in applications, where otherwise multiple instances of AngularTS try to work on the DOM. **Note:** Do not bootstrap the app on an element with a directive that uses transclusion, such as `ng-if`, `ng-include`, or `ng-view`. Doing this misplaces the app root element and injector, causing animations to stop working and making the injector inaccessible from outside the app. ```html <!doctype html> <html> <body> <div ng-controller="WelcomeController"> {{greeting}} </div> <script src="angular.js"></script> <script> let app = angular.module('demo', []) .controller('WelcomeController', ['$scope', function($scope) { $scope.greeting = 'Welcome!'; }]); angular.bootstrap(document, ['demo']); </script> </body> </html> ```- Parameters:
element- DOM element which is the root of AngularTS application.modules- an array of modules to load into the application. Each item in the array should be the name of a predefined module or a (DI annotated) function that will be invoked by the injector as a `config` block. See `angular.module()`.- Returns:
- Method result.
-
bootstrap
@JsOverlay default InjectorService<Object> bootstrap(Document element, elemental2.core.JsArray<Object> modules) Use this function to manually start up AngularTS application. AngularTS will detect if it has been loaded into the browser more than once and only allow the first loaded script to be bootstrapped and will report a warning to the browser console for each of the subsequent scripts. This prevents strange results in applications, where otherwise multiple instances of AngularTS try to work on the DOM. **Note:** Do not bootstrap the app on an element with a directive that uses transclusion, such as `ng-if`, `ng-include`, or `ng-view`. Doing this misplaces the app root element and injector, causing animations to stop working and making the injector inaccessible from outside the app. ```html <!doctype html> <html> <body> <div ng-controller="WelcomeController"> {{greeting}} </div> <script src="angular.js"></script> <script> let app = angular.module('demo', []) .controller('WelcomeController', ['$scope', function($scope) { $scope.greeting = 'Welcome!'; }]); angular.bootstrap(document, ['demo']); </script> </body> </html> ```- Parameters:
element- DOM element which is the root of AngularTS application.modules- an array of modules to load into the application. Each item in the array should be the name of a predefined module or a (DI annotated) function that will be invoked by the injector as a `config` block. See `angular.module()`.- Returns:
- Method result.
-
bootstrap
@JsOverlay default InjectorService<Object> bootstrap(elemental2.dom.HTMLElement element, elemental2.core.JsArray<Object> modules) Use this function to manually start up AngularTS application. AngularTS will detect if it has been loaded into the browser more than once and only allow the first loaded script to be bootstrapped and will report a warning to the browser console for each of the subsequent scripts. This prevents strange results in applications, where otherwise multiple instances of AngularTS try to work on the DOM. **Note:** Do not bootstrap the app on an element with a directive that uses transclusion, such as `ng-if`, `ng-include`, or `ng-view`. Doing this misplaces the app root element and injector, causing animations to stop working and making the injector inaccessible from outside the app. ```html <!doctype html> <html> <body> <div ng-controller="WelcomeController"> {{greeting}} </div> <script src="angular.js"></script> <script> let app = angular.module('demo', []) .controller('WelcomeController', ['$scope', function($scope) { $scope.greeting = 'Welcome!'; }]); angular.bootstrap(document, ['demo']); </script> </body> </html> ```- Parameters:
element- DOM element which is the root of AngularTS application.modules- an array of modules to load into the application. Each item in the array should be the name of a predefined module or a (DI annotated) function that will be invoked by the injector as a `config` block. See `angular.module()`.- Returns:
- Method result.
-
bootstrap
@JsOverlay default InjectorService<Object> bootstrap(String element, elemental2.core.JsArray<Object> modules) Use this function to manually start up AngularTS application. AngularTS will detect if it has been loaded into the browser more than once and only allow the first loaded script to be bootstrapped and will report a warning to the browser console for each of the subsequent scripts. This prevents strange results in applications, where otherwise multiple instances of AngularTS try to work on the DOM. **Note:** Do not bootstrap the app on an element with a directive that uses transclusion, such as `ng-if`, `ng-include`, or `ng-view`. Doing this misplaces the app root element and injector, causing animations to stop working and making the injector inaccessible from outside the app. ```html <!doctype html> <html> <body> <div ng-controller="WelcomeController"> {{greeting}} </div> <script src="angular.js"></script> <script> let app = angular.module('demo', []) .controller('WelcomeController', ['$scope', function($scope) { $scope.greeting = 'Welcome!'; }]); angular.bootstrap(document, ['demo']); </script> </body> </html> ```- Parameters:
element- DOM element which is the root of AngularTS application.modules- an array of modules to load into the application. Each item in the array should be the name of a predefined module or a (DI annotated) function that will be invoked by the injector as a `config` block. See `angular.module()`.- Returns:
- Method result.
-
call
Await result. Accepts a single string: `"<target>.<expression>"`- Parameters:
input- Value supplied for the input parameter.- Returns:
- Method result.
-
dispatchEvent
boolean dispatchEvent(elemental2.dom.Event event) Dispatches an invocation event to either an injectable service or a named scope. The event `type` identifies the target and the payload contains the expression to evaluate against that target.- Parameters:
event- Value supplied for the event parameter.- Returns:
- Method result.
-
emit
Fire-and-forget. Accepts a single string: `"<target>.<expression>"`- Parameters:
input- Value supplied for the input parameter.
-
errorFormattingConfig
Configure how values embedded in framework error messages are formatted.- Parameters:
config- Value supplied for the config parameter.- Returns:
- Method result.
-
getController
Retrieve the controller instance cached on a compiled DOM element.- Parameters:
element- The DOM element to get data from.name- Controller name.- Returns:
- Method result.
-
getCurrentInjector
Application injector, available after `bootstrap()` or `injector()` completes. -
getEventBus
Application-wide event bus, available after bootstrap providers are created. -
getInjector
Retrieve the injector cached on a bootstrapped DOM element.- Parameters:
element- Value supplied for the element parameter.- Returns:
- Method result.
-
getNormalizedAttr
Read an element attribute by normalized directive-style name.- Parameters:
element- Value supplied for the element parameter.normalizedName- Value supplied for the normalizedName parameter.- Returns:
- Method result.
-
getNormalizedAttrName
Return the actual DOM attribute name for a normalized directive-style name.- Parameters:
element- Value supplied for the element parameter.normalizedName- Value supplied for the normalizedName parameter.- Returns:
- Method result.
-
getRootScope
Root scope for the bootstrapped application. -
getScope
Retrieve the scope cached on a compiled DOM element.- Parameters:
element- The DOM element to get data from.- Returns:
- Method result.
-
getScopeByName
Find a scope by its registered `scopeName`.- Parameters:
name- Scope name to search for.- Returns:
- Method result.
-
getScopeElement
Base class for user-authored AngularTS custom elements. -
getSubapps
Sub-application instances created when multiple `ng-app` roots are initialized. -
getTokens
Public injection token names keyed by token value. -
getVersion
AngularTS version string replaced at build time. -
getView
Explicit programmatic-view binding and element helpers. -
hasNormalizedAttr
Return whether an element has an attribute matching a normalized name.- Parameters:
element- Value supplied for the element parameter.normalizedName- Value supplied for the normalizedName parameter.- Returns:
- Method result.
-
init
Find `ng-app` roots under the provided element and bootstrap them. The first root uses this instance. Additional roots are bootstrapped as sub-applications and stored insubapps.- Parameters:
element- Root element or document to scan.
-
init
@JsOverlay default void init(elemental2.dom.HTMLElement element) Find `ng-app` roots under the provided element and bootstrap them. The first root uses this instance. Additional roots are bootstrapped as sub-applications and stored insubapps.- Parameters:
element- Root element or document to scan.
-
init
Find `ng-app` roots under the provided element and bootstrap them. The first root uses this instance. Additional roots are bootstrapped as sub-applications and stored insubapps.- Parameters:
element- Root element or document to scan.
-
injector
Create a standalone injector without bootstrapping the DOM.- Parameters:
modules- Module names or config functions to load.- Returns:
- Method result.
-
module
The `angular.module` is a global place for creating, registering and retrieving AngularTS modules. All modules (AngularTS core or 3rd party) that should be available to an application must be registered using this mechanism. Passing one argument retrieves an existing ng.NgModule, whereas passing more than one argument creates a new ng.NgModule # Module A module is a collection of services, directives, controllers, filters, workers, WebAssembly modules, and configuration information. `angular.module` is used to configure the auto.$injector `$injector`. ```js // Create a new module let myModule = angular.module('myModule', []); // register a new service myModule.value('appName', 'MyCoolApp'); // configure built-in services with typed object config. myModule.config({ location: { hashPrefix: '!', }, }); ``` Then you can create an injector and load your modules like this: ```js let injector = angular.injector(['ng', 'myModule']) ``` However it's more likely that you'll use the `ng-app` directive or `bootstrap()` to simplify this process.- Parameters:
name- The name of the module to create or retrieve.requires- If specified then new module is being created. If unspecified then the module is being retrieved for further configuration.configFn- Optional configuration function for the module that gets passed to `NgModule.config()`.- Returns:
- Method result.
-
registerNgModule
NgModule registerNgModule()Registers the configured built-in `ng` module for this runtime instance.- Returns:
- Method result.
-
setCurrentInjector
Application injector, available after `bootstrap()` or `injector()` completes. -
setEventBus
Application-wide event bus, available after bootstrap providers are created. -
setRootScope
Root scope for the bootstrapped application. -
setScopeElement
Base class for user-authored AngularTS custom elements. -
setSubapps
Sub-application instances created when multiple `ng-app` roots are initialized. -
setTokens
Public injection token names keyed by token value. -
setVersion
AngularTS version string replaced at build time. -
setView
Explicit programmatic-view binding and element helpers. -
tags
JSX-free real-DOM tag factories for programmatic component views.- Parameters:
namespaceUri- Value supplied for the namespaceUri parameter.- Returns:
- Method result.
-