作者:BerniceChu
项目:land
export function bootstrap(
appComponentType: Type,
customAppProviders: Array<any> = null,
customComponentProviders: Array<any> = null): Promise<ComponentRef<any>> {
reflector.reflectionCapabilities = new ReflectionCapabilities();
let appProviders: Array<any> = [
...NODE_APP_PROVIDERS,
new Provider(DOCUMENT, {
useFactory: (directiveResolver, sharedStylesHost) => {
// TODO(gdi2290): determine a better for document on the server
let selector = directiveResolver.resolve(appComponentType);
let serverDocument = DOM.createHtmlDocument();
let el = DOM.createElement(selector);
DOM.appendChild(serverDocument.body, el);
sharedStylesHost.addHost(serverDocument.head);
return serverDocument;
},
deps: [DirectiveResolver, NodeSharedStylesHost]
}),
...(isPresent(customAppProviders) ? customAppProviders : [])
];
let componentProviders: Array<any> = [
...(isPresent(customComponentProviders) ? customComponentProviders : [])
];
let platform = createPlatform(ReflectiveInjector.resolveAndCreate(NODE_APP_PLATFORM));
return coreLoadAndBootstrap(platform.injector, appComponentType);
}
作者:BerniceChu
项目:land
export function buildNodeAppProviders(document?: any, providers?: Array<any>): Array<any> {
return [
...NODE_APP_PROVIDERS,
(isPresent(document) && document) ? [
new Provider(DOCUMENT, {
useFactory: (sharedStylesHost) => {
sharedStylesHost.addHost(document.head);
return document;
},
deps: [NodeSharedStylesHost]
})
] : [],
...(isPresent(providers) && providers) ? providers : []
];
}
作者:BerniceChu
项目:land
export function buildNodePlatformProviders(
appComponentType: Type,
providers?: Array<any>): Array<any> {
return [
...NODE_APP_PLATFORM,
...(isPresent(providers) ? providers : [])
];
}
作者:chg
项目:Angular2WithRedu
transform(todos, args) {
let data = [];
if(todos){
data = todos.toArray();
}
if (isPresent(data) && !isArray(data)) {
throw new BaseException('VisibleTodos pipe requires an Array as input');
}
return this.getVisibleTodos(data, args);
}
作者:Hongbo-Mia
项目:angular2-meteor-universa
private bootstrap(component: Type,
providers: Providers,
options: ServerOptions) {
let doc = this.createDoc(component);
let customProviders = buildNodeAppProviders(doc, this.getAppProviders(options));
customProviders = isPresent(providers) ? [...providers, ...customProviders]
: customProviders;
let bootstrapping = MeteorApp.bootstrap(component, buildNodeProviders(), customProviders);
return bootstrapping.then(compRef => ({
appRef: compRef.injector.get(ApplicationRef),
compRef
}));
}
作者:gotasci
项目:gear_list_browser_clien
ngDoCheck() {
if(!this.subscribed && isPresent(this.stream$)) {
this.stream$.subscribe((e) => {
this.materialized = false;
});
this.subscribed = true;
console.log('mater subscribed!');
}
if (!this.materialized && $('.dropdown-button').length > 0) {
$('.dropdown-button').dropdown({});
this.materialized = true;
console.log('materialized!');
}
}
作者:chrisbe
项目:angular2-renderer-exampl
export function customBootstrap(appComponentType: any, customProviders: Provider[] = null): Promise<ComponentRef<any>> {
CustomDomAdapter.makeCurrent();
let logger = {
logGroup: () => {
console.log('---');
},
logError: (error: Error) => {
console.error(error);
},
logGroupEnd: () => {
console.log('---');
}
};
let platformProviders = [
PLATFORM_COMMON_PROVIDERS,
provide(XHR, { useClass: XHRShim }),
provide(ExceptionHandler, { useFactory: () => new ExceptionHandler(logger, true), deps: [] })
];
let appProviders = [
APPLICATION_COMMON_PROVIDERS,
COMPILER_PROVIDERS,
SanitizationService,
CustomRootRenderer,
provide(RootRenderer, { useClass: CustomRootRenderer }),
CustomRenderer,
provide(Renderer, { useClass: CustomRenderer })
];
if (customProviders) {
appProviders.push(customProviders);
}
let platform = getPlatform();
if (!isPresent(platform)) {
platform = createPlatform(ReflectiveInjector.resolveAndCreate(platformProviders));
}
reflector.reflectionCapabilities = new ReflectionCapabilities();
let appInjector = ReflectiveInjector.resolveAndCreate(appProviders, platform.injector);
return coreLoadAndBootstrap(appInjector, appComponentType);
}
作者:node-packag
项目:dashboar
transform(value:string, args:any[]):any {
this.length = isPresent(args[0]) ? args[0] : 100;
this.placeholderEnd = (value.length < this.length) ? '' : isPresent(args[1]) ? args[1] : ' ...';
return value.substring(0, this.length).concat(this.placeholderEnd);
}
作者:BerniceChu
项目:land
export function buildNodeProviders(providers?: Array<any>): Array<any> {
return [
...NODE_APP_PLATFORM,
...(isPresent(providers) ? providers : [])
];
}
作者:arnaudvall
项目:nativescript-ng2-fontico
_dispose(): void {
if (isPresent(this.iconSub)) {
this.iconSub.unsubscribe();
this.iconSub = undefined;
}
}