Class NgModule

java.lang.Object
org.angular.ts.ng.NgModule

@JsType(isNative=true, name="ng.NgModule", namespace="<global>") public class NgModule extends Object
AngularTS module registration surface for controllers, directives, services, factories, providers, filters, run blocks, and config blocks.
  • Field Details

    • name

      public String name
      Public NgModule.name member exposed by the AngularTS namespace contract.
  • Constructor Details

    • NgModule

      public NgModule()
  • Method Details

    • animation

      public NgModule animation(String name, Object animationFactory)
      Public NgModule.animation member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      animationFactory - Value supplied for the animationFactory parameter.
      Returns:
      Method result.
    • appComponent

      public <T> NgModule appComponent(String name, AppComponentOptions<T> options)
      Register an options-backed application host custom element. The definition is installed when the module runs. The host element is a native custom element backed by an AngularTS child scope.
      Parameters:
      name - Custom element tag name.
      options - App component options.
      Returns:
      Method result.
    • component

      public NgModule component(String name, Object options)
      Public NgModule.component member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      options - Value supplied for the options parameter.
      Returns:
      Method result.
    • config

      public NgModule config(Object config)
      Declare built-in AngularTS service configuration during the config phase.
      Parameters:
      config - Built-in config map.
      Returns:
      Method result.
    • constant

      public NgModule constant(String name, Object object)
      Public NgModule.constant member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      object - Value supplied for the object parameter.
      Returns:
      Method result.
    • controller

      public NgModule controller(String name, Object ctlFn)
      The $controller service is used by Angular to create new controllers. Named controllers are stored in the owning runtime's controller registry.
      Parameters:
      name - Controller name
      ctlFn - Controller constructor fn (optionally decorated with DI annotations in the array notation)
      Returns:
      Method result.
    • decorator

      public NgModule decorator(String name, Object decorFn)
      Public NgModule.decorator member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      decorFn - Value supplied for the decorFn parameter.
      Returns:
      Method result.
    • directive

      public NgModule directive(String name, DirectiveFactoryFn directiveFactory)
      Public NgModule.directive member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      directiveFactory - Value supplied for the directiveFactory parameter.
      Returns:
      Method result.
    • factory

      public NgModule factory(String name, Object providerFunction)
      Public NgModule.factory member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      providerFunction - Value supplied for the providerFunction parameter.
      Returns:
      Method result.
    • filter

      public NgModule filter(String name, Object filterFn)
      Public NgModule.filter member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      filterFn - Value supplied for the filterFn parameter.
      Returns:
      Method result.
    • lazyState

      public NgModule lazyState(String prefix, org.angular.ts.ng.NgModule.LazyStateLoader loader)
      Register a lazy router state namespace during module configuration. Lazy route declarations use the same composed router runtime as static module routes.
      Parameters:
      prefix - State name prefix to load on demand.
      loader - Loader invoked by the router when a transition targets the prefix.
      Returns:
      Method result.
    • machine

      public NgModule machine(String name, Object config)
      Register a named reactive state machine as an injectable service. The machine is created by `$machine` when the named service is requested. The returned instance is not tied to any one scope lifetime; it registers with AngularTS scope proxies when assigned to a controller or scope.
      Parameters:
      name - Injectable name.
      config - Machine configuration or a resolvable config factory.
      Returns:
      Method result.
    • model

      public NgModule model(String name, Object initial)
      Register a named reactive model as an injectable app-owned service. The model is created lazily by the owning `AppContext` when the service is first injected. Models are shared across every root scope managed by the same `AppContext`; they are not children of `$rootScope`. Assign an injected model to a controller or scope property to bind it in a template. DOM interpolation, `ng-bind`, directive expressions, nested object reads, and array length reads update when the app model changes. Mutating the model proxy schedules every affected observer. The injected `Model<T>` value is proxy-backed. It exposes scope-proxy methods such as `watch`, `batch`, `merge`, `on`, `emit`, `broadcast`, and `destroy`, plus `snapshot`, `restore`, and `sync` for model lifecycle and synchronization. Prefer the factory form for nontrivial initial state: ```ts app.model("user", () => ({ name: "John", authenticated: false })); ```
      Parameters:
      name - Injectable model name.
      initial - Plain object state or an injectable factory that returns plain object state.
      Returns:
      Method result.
    • provider

      public NgModule provider(String name, Object providerType)
      Public NgModule.provider member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      providerType - Value supplied for the providerType parameter.
      Returns:
      Method result.
    • rest

      public NgModule rest(String name, String url, Object entityClass, Object options)
      Register a REST resource as an injectable service. The resource factory is delegated to the injected `$rest` service, keeping REST support configurable by custom runtimes.
      Parameters:
      name - Service name.
      url - Base URL or URI template.
      entityClass - Optional constructor for mapping JSON.
      options - Optional RestService options, optionally produced by DI.
      Returns:
      Method result.
    • router

      public <TDeclaration> RouterModule<RoutesOf<TDeclaration,Object>> router(TDeclaration declaration)
      Register a module-owned router state tree during module configuration. Child state names are relative to their parent unless they contain a dot. Each route is queued for the composed router runtime, so module router trees compose with `lazyState(...)` and inherited route policies. RouterModuleDeclaration is the only public registration contract. Pass one declaration or a readonly forest; the route map is inferred from the exact literal. To declare the route map explicitly, parameterize `createModule<TRouteMap>(...)` instead of `router(...)`.
      Parameters:
      declaration - Router tree root declaration.
      Returns:
      Method result.
    • run

      public NgModule run(Object block)
      Public NgModule.run member exposed by the AngularTS namespace contract.
      Parameters:
      block - Value supplied for the block parameter.
      Returns:
      Method result.
    • service

      public NgModule service(String name, Object serviceFunction)
      Public NgModule.service member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      serviceFunction - Value supplied for the serviceFunction parameter.
      Returns:
      Method result.
    • serviceWorker

      public NgModule serviceWorker(Object scriptUrl, ServiceWorkerConfig config)
      Configure the singleton `$serviceWorker` for this application.
      Parameters:
      scriptUrl - Value supplied for the scriptUrl parameter.
      config - Value supplied for the config parameter.
      Returns:
      Method result.
    • sse

      public NgModule sse(String name, String url, Object config)
      Register a pre-configured SSE connection as an injectable service. The connection is created by `$sse` when the named service is requested.
      Parameters:
      name - Injectable name.
      url - SSE endpoint.
      config - SSE connection options, optionally produced by DI.
      Returns:
      Method result.
    • store

      public NgModule store(String name, Object ctor, String type, Object backendOrConfig)
      Register a persistent object store as an injectable service. Store construction is delegated to the internal provider registry, which creates the service through the injector and persists it through the selected backend.
      Parameters:
      name - Service name.
      ctor - Constructor, factory, or object to persist.
      type - Storage backend type.
      backendOrConfig - Custom backend or persistence options.
      Returns:
      Method result.
    • value

      public NgModule value(String name, Object object)
      Public NgModule.value member exposed by the AngularTS namespace contract.
      Parameters:
      name - Value supplied for the name parameter.
      object - Allows undefined
      Returns:
      Method result.
    • wasm

      public NgModule wasm(String name, Object config)
      Register a named WebAssembly module as an injectable resource. The actual loading is delegated to the `$wasm` service, so custom runtimes can decide whether WebAssembly support is included.
      Parameters:
      name - Injectable name used to access the resource.
      config - Module source and imports, optionally produced by DI.
      Returns:
      Method result.
    • webComponent

      public <T> NgModule webComponent(String name, ScopeElementConstructor<T> elementClass)
      Register a user-authored native custom element backed by an AngularTS scope. The element class must extend `ScopeElement`. Its static template, shadow, scope, inputs, and isolate properties configure the AngularTS wiring.
      Parameters:
      name - Custom element tag name.
      elementClass - Custom element class.
      Returns:
      Method result.
    • webTransport

      public NgModule webTransport(String name, String url, Object config)
      Register a pre-configured WebTransport connection as an injectable service. The connection is created by `$webTransport` when the named service is requested.
      Parameters:
      name - Injectable name.
      url - WebTransport endpoint.
      config - WebTransport connection options, optionally produced by DI.
      Returns:
      Method result.
    • websocket

      public NgModule websocket(String name, String url, Object config)
      Register a pre-configured WebSocket connection as an injectable service. The connection is created by `$websocket` when the named service is requested.
      Parameters:
      name - Injectable name.
      url - WebSocket endpoint.
      config - WebSocket connection options, optionally produced by DI.
      Returns:
      Method result.
    • worker

      public NgModule worker(String name, Object scriptPath, Object config)
      Register a named Web Worker connection as an injectable service. The actual connection is delegated to the `$worker` provider, so worker support remains provider-driven instead of directive-driven.
      Parameters:
      name - Injectable name.
      scriptPath - Worker script URL, optionally produced by DI.
      config - Worker connection options, optionally produced by DI.
      Returns:
      Method result.
    • workflow

      public NgModule workflow(String name, Object config)
      Register a named workflow as an injectable service. The workflow is created by `$workflow` when the named service is requested. Workflow behavior remains local to its `WorkflowConfig`; the provider does not apply global workflow defaults.
      Parameters:
      name - Injectable name.
      config - Workflow configuration or a resolvable config factory.
      Returns:
      Method result.
    • workflowSupervisor

      public NgModule workflowSupervisor(String name, Object config)
      Register a named workflow supervisor as an injectable service. The supervisor is created when the named service is requested. It composes existing workflow configs or workflow instances and keeps persistence and recovery policy local to the supervisor config.
      Parameters:
      name - Injectable name.
      config - Supervisor configuration or a resolvable config factory.
      Returns:
      Method result.