本文整理汇总了TypeScript中angular.IModule类的典型用法代码示例。如果您正苦于以下问题:TypeScript IModule类的具体用法?TypeScript IModule怎么用?TypeScript IModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IModule类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: registerComponents
export function registerComponents(module:IModule) {
module
.component('appMain', new AppMainComponent())
.component('tarAbout', new AboutComponent())
.component('tarHome', new HomeComponent())
.component('tarCounter', new CounterComponent());
}
示例2: function
return function(target: any): any {
var moduleName: string = target.name;
var imports: any[] = options.imports || [];
var app: IModule = angular.module(moduleName, imports);
if (options.declarations.length > 0) {
for(let component of options.declarations) {
// tslint:disable-next-line:no-string-literal
console.log(`[ComponentRegistration] ${component["controller"].name} selector: ${component.selector}`);
app.component(component.selector, component);
}
}
if (options.providers.length > 0) {
for(let service of options.providers) {
console.log(`[ServiceRegistration] ${service.name}`);
app.service(service.name, service);
}
}
return target;
};
示例3: Config
'use strict';
/** @internal */
import * as angular from 'angular';
import {IModule} from 'angular';
import {Config} from './model/config.model';
import {W11KSelectHelper} from './w11k-select-helper.factory';
import {w11kSelect} from './w11k-select.directive';
import {w11kSelectOptionDirective} from './w11k-select-option/w11k-select-option.directive';
import {w11kSelectCheckboxDirective} from './w11k-select-checkbox/w11k-checkbox.directive';
import {w11kSelectInfiniteScroll} from './w11k-select-infinite-scroll.directive';
import {keyListener} from './lib/key-listener';
export const module: IModule = angular.module('w11k.select', [
'w11k.dropdownToggle',
'w11k.select.template'
]);
module
.constant('w11kSelectConfig', new Config())
.directive('w11kSelectInfiniteScroll', w11kSelectInfiniteScroll)
.service('w11kSelectHelper', W11KSelectHelper)
.directive('w11kSelect', w11kSelect)
.directive('w11kSelectOption', w11kSelectOptionDirective)
.directive('w11kSelectCheckbox', w11kSelectCheckboxDirective)
.directive('keyListener', keyListener);
示例4: provide
provide(module: IModule): DirectiveMockSupplier<any> {
module.directive(this.name, () => this.directive);
return this.mock;
}
示例5: init
/**
* This method is equivalent to angular.module.config & angular.module.run
*/
private init(router: IRouteFunction) {
this.module = angular.module(this.setting.name, ['ngMessages', 'ui.router', 'ngMaterial']);
this.module.constant('Setting', this.setting);
// CONFIG
AppMenuService.setMenuItems('main-menu', AppMenu);
BreadcrumbController.setAppStates(AppMenu);
AuthService.setDefaultPolicy(AclPolicy.Deny);
this.module.config(['$stateProvider', '$locationProvider', '$urlRouterProvider', '$httpProvider', '$compileProvider',
function ($stateProvider: IStateProvider, $locationProvider: ILocationProvider, $urlRouterProvider: IUrlRouterProvider, $httpProvider: IHttpProvider, $compileProvider: ICompileProvider) {
$compileProvider.debugInfoEnabled(ClientApp.Setting.env != 'production');
$httpProvider.useApplyAsync(true);
router($stateProvider, $locationProvider, $urlRouterProvider);
}]);
/**
* Initiating common services; These services are likely to be injected everywhere
* After this, these services can be used by their `getInstance` method. e.g AuthService.getInstance()
* This action will cause the DI on class names to be much shorter => increasing the readability
*/
this.module.run(['apiService', 'authService', 'logService', 'formService', 'notificationService', 'metaTagsService', 'translateService', (apiService, authService, logService, formService, notificationService, metaTagsService, translateService)=> {
}]);
// RUN
this.module.run(['$rootScope', '$state', 'networkService', 'i18nService', 'appCacheService',
($rootScope: IExtRootScopeService, $state: IStateService, networkService: NetworkService, i18nService: I18nService, appCacheService: AppCacheService)=> {
$rootScope.locale = i18nService.get();
this.aclCheck($rootScope, $state);
this.connectionWatcher(networkService);
appCacheService.update();
this.checkAuthStatus($state);
}]);
}