本文整理汇总了TypeScript中angular2/src/facade/lang.CONST_EXPR函数的典型用法代码示例。如果您正苦于以下问题:TypeScript CONST_EXPR函数的具体用法?TypeScript CONST_EXPR怎么用?TypeScript CONST_EXPR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CONST_EXPR函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: iterableChangesAsString
export function iterableChangesAsString({collection = CONST_EXPR([]), previous = CONST_EXPR([]),
additions = CONST_EXPR([]), moves = CONST_EXPR([]),
removals = CONST_EXPR([])}) {
return "collection: " + collection.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
"additions: " + additions.join(', ') + "\n" + "moves: " + moves.join(', ') + "\n" +
"removals: " + removals.join(', ') + "\n";
}
示例2: makeLocation
function makeLocation(baseHref: string = '/my/app', provider: any = CONST_EXPR([])): Location {
locationStrategy = new MockLocationStrategy();
locationStrategy.internalBaseHref = baseHref;
let injector = Injector.resolveAndCreate(
[Location, provide(LocationStrategy, {useValue: locationStrategy}), provider]);
return location = injector.get(Location);
}
示例3: makeLocation
function makeLocation(baseHref: string = '/my/app', binding: any = CONST_EXPR([])): Location {
locationStrategy = new MockLocationStrategy();
locationStrategy.internalBaseHref = baseHref;
let injector = Injector.resolveAndCreate(
[Location, bind(LocationStrategy).toValue(locationStrategy), binding]);
return location = injector.get(Location);
}
示例4: makeRouter
function makeRouter(baseHref: string = '/my/app', provider: any = CONST_EXPR([])): Router {
locationStrategy = new MockLocationStrategy();
locationStrategy.internalBaseHref = baseHref;
let injector = ReflectiveInjector.resolveAndCreate(
[Router, provide(LocationStrategy, {useValue: locationStrategy}), provider]);
return router = injector.get(Router);
}
示例5: makeLocation
function makeLocation(baseHref: string = '/my/app', binding: any = CONST_EXPR([])): Location {
browserLocation = new DummyBrowserLocation();
browserLocation.internalBaseHref = baseHref;
let injector = Injector.resolveAndCreate(
[Location, bind(BrowserLocation).toValue(browserLocation), binding]);
return location = injector.get(Location);
}
示例6: detectChanges
function detectChanges(compiler: ChangeDetectionCompiler, template: string,
directives: CompileDirectiveMetadata[] = CONST_EXPR([])): string[] {
var type =
new CompileTypeMetadata({name: stringify(SomeComponent), moduleUrl: THIS_MODULE_URL});
var parsedTemplate = parser.parse(template, directives, 'TestComp');
var factories =
compiler.compileComponentRuntime(type, ChangeDetectionStrategy.Default, parsedTemplate);
return testChangeDetector(factories[0]);
}
示例7: iterableChangesAsString
export function iterableChangesAsString(
{collection = CONST_EXPR([]), previous = CONST_EXPR([]), additions = CONST_EXPR([]),
moves = CONST_EXPR([]), removals = CONST_EXPR([]), identityChanges = CONST_EXPR([])}) {
return 'collection: ' + collection.join(', ') + '\n' +
'previous: ' + previous.join(', ') + '\n' +
'additions: ' + additions.join(', ') + '\n' +
'moves: ' + moves.join(', ') + '\n' +
'removals: ' + removals.join(', ') + '\n' +
'identityChanges: ' + identityChanges.join(', ') + '\n';
}
示例8: validator
import {forwardRef, Binding} from 'angular2/di';
import {CONST_EXPR} from 'angular2/src/facade/lang';
import {Directive} from '../../../angular2';
import {Validators} from '../validators';
export class NgValidator {
get validator(): Function { throw "Is not implemented"; }
}
const requiredValidatorBinding =
CONST_EXPR(new Binding(NgValidator, {toAlias: forwardRef(() => NgRequiredValidator)}));
@Directive({
selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]',
hostInjector: [requiredValidatorBinding]
})
export class NgRequiredValidator extends NgValidator {
get validator(): Function { return Validators.required; }
}
示例9: CONST_EXPR
import {OpaqueToken} from 'angular2/di';
import {CONST_EXPR} from 'angular2/src/facade/lang';
export const appComponentRefToken: OpaqueToken = CONST_EXPR(new OpaqueToken('ComponentRef'));
export const appComponentTypeToken: OpaqueToken = CONST_EXPR(new OpaqueToken('RootComponent'));