Configuration option for AngularTS bootstrap process.

Constructors

Properties

bootsrappedModules: any[]
cache: Map<number, ExpandoStore>
doBootstrap: Function
element: typeof JQLite
version: string

Methods

  • Use this function to manually start up AngularJS application.

    AngularJS 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 AngularJS try to work on the DOM. *

    **Note:** Do not bootstrap the app on an element with a directive that uses ng.$compile#transclusion transclusion, such as ng.ngIf `ngIf`, ng.ngInclude `ngInclude` and ngRoute.ngView `ngView`. Doing this misplaces the app ng.$rootElement `$rootElement` and the app's auto.$injector injector, causing animations to stop working and making the injector inaccessible from outside the app.
    <!doctype html>
    <html>
    <body>
    <div ng-controller="WelcomeController">
    {{greeting}}
    </div>

    <script src="angular.js"></script>
    <script>
    let app = angular.module('demo', [])
    .controller('WelcomeController', function($scope) {
    $scope.greeting = 'Welcome!';
    });
    angular.bootstrap(document, ['demo']);
    </script>
    </body>
    </html>

    Parameters

    • element: string | Element | Document

      DOM element which is the root of AngularJS application.

    • Optionalmodules: any[]

      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 modules

    • Optionalconfig: AngularBootstrapConfig

      an object for defining configuration options for the application. The following keys are supported:

      • strictDi - disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. Defaults to false.

    Returns any

    InjectorService - Returns the newly created injector for this app.

  • Configure several aspects of error handling if used as a setter or return the current configuration if used as a getter.

    Omitted or undefined options will leave the corresponding configuration values unchanged.

    Parameters

    Returns ErrorHandlingConfig

  • Parameters

    • element: Element | Document

    Returns void

  • The angular.module is a global place for creating, registering and retrieving AngularJS modules. All modules (AngularJS core or 3rd party) that should be available to an application must be registered using this mechanism.

    Passing one argument retrieves an existing import('./types').Module, whereas passing more than one argument creates a new import('./types').Module

    Module

    A module is a collection of services, directives, controllers, filters, and configuration information. angular.module is used to configure the auto.$injector $injector.

    // Create a new module
    let myModule = angular.module('myModule', []);

    // register a new service
    myModule.value('appName', 'MyCoolApp');

    // configure existing services inside initialization blocks.
    myModule.config(['$locationProvider', function($locationProvider) {
    // Configure existing providers
    $locationProvider.hashPrefix('!');
    }]);

    Then you can create an injector and load your modules like this:

    let injector = angular.injector(['ng', 'myModule'])
    

    However it's more likely that you'll just use ng.directive:ngApp ngApp or angular.bootstrap to simplify this process for you.

    Parameters

    • name: string

      The name of the module to create or retrieve.

    • Optionalrequires: string[]

      If specified then new module is being created. If unspecified then the module is being retrieved for further configuration.

    • OptionalconfigFn: Function | any[]

      Optional configuration function for the module. Same as import('./types').Module#config Module#config().

    Returns NgModule

    A newly registered module.

  • Parameters

    • extraModules: any

    Returns any