refactor: change provide(...) for {provide: ...}
- provide() is deprecated, - {} syntax is required by the offline compiler
This commit is contained in:
@ -49,7 +49,7 @@ export abstract class NgLocalization { abstract getPluralCategory(value: any): s
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'app',
|
||||
* providers: [provide(NgLocalization, {useClass: MyLocalization})]
|
||||
* providers: [{provide: NgLocalization, useClass: MyLocalization}]
|
||||
* })
|
||||
* @View({
|
||||
* template: `
|
||||
|
@ -7,7 +7,6 @@ import {
|
||||
Host,
|
||||
SkipSelf,
|
||||
forwardRef,
|
||||
Provider,
|
||||
Self
|
||||
} from '@angular/core';
|
||||
import {ControlContainer} from './control_container';
|
||||
|
@ -6,7 +6,6 @@ import {
|
||||
Optional,
|
||||
Host,
|
||||
OnDestroy,
|
||||
Provider,
|
||||
forwardRef
|
||||
} from "@angular/core";
|
||||
import {
|
||||
|
@ -13,7 +13,7 @@ import {AbstractControl} from '../model';
|
||||
* ```typescript
|
||||
* @Directive({
|
||||
* selector: '[custom-validator]',
|
||||
* providers: [provide(NG_VALIDATORS, {useExisting: CustomValidatorDirective, multi: true})]
|
||||
* providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
|
||||
* })
|
||||
* class CustomValidatorDirective implements Validator {
|
||||
* validate(c: Control): {[key: string]: any} {
|
||||
|
@ -42,7 +42,7 @@ import {UrlChangeListener, PlatformLocation} from './platform_location';
|
||||
*
|
||||
* bootstrap(AppCmp, [
|
||||
* ROUTER_PROVIDERS,
|
||||
* provide(LocationStrategy, {useClass: HashLocationStrategy})
|
||||
* {provide: LocationStrategy, useClass: HashLocationStrategy}
|
||||
* ]);
|
||||
* ```
|
||||
*
|
||||
|
@ -56,7 +56,7 @@ export abstract class LocationStrategy {
|
||||
*
|
||||
* bootstrap(AppCmp, [
|
||||
* ROUTER_PROVIDERS,
|
||||
* provide(APP_BASE_HREF, {useValue: '/my/app'})
|
||||
* {provide: APP_BASE_HREF, useValue: '/my/app'}
|
||||
* ]);
|
||||
* ```
|
||||
* @stable
|
||||
|
@ -26,7 +26,7 @@ import {Location} from './location';
|
||||
* ### Example
|
||||
*
|
||||
* ```
|
||||
* import {Component, provide} from '@angular/core';
|
||||
* import {Component} from '@angular/core';
|
||||
* import {bootstrap} from '@angular/platform-browser/browser';
|
||||
* import {
|
||||
* Location,
|
||||
@ -50,7 +50,7 @@ import {Location} from './location';
|
||||
*
|
||||
* bootstrap(AppCmp, [
|
||||
* ROUTER_PROVIDERS, // includes binding to PathLocationStrategy
|
||||
* provide(APP_BASE_HREF, {useValue: '/my/app'})
|
||||
* {provide: APP_BASE_HREF, useValue: '/my/app'}
|
||||
* ]);
|
||||
* ```
|
||||
*
|
||||
|
@ -10,14 +10,14 @@ import {
|
||||
xit,
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
|
||||
import {TestComponentBuilder} from '@angular/compiler/testing';
|
||||
|
||||
import {Component, Injectable, provide} from '@angular/core';
|
||||
import {Component, Injectable} from '@angular/core';
|
||||
import {NgPlural, NgPluralCase, NgLocalization} from '@angular/common';
|
||||
|
||||
export function main() {
|
||||
describe('switch', () => {
|
||||
beforeEachProviders(() => [provide(NgLocalization, {useClass: TestLocalizationMap})]);
|
||||
beforeEachProviders(() => [{provide: NgLocalization, useClass: TestLocalizationMap}]);
|
||||
|
||||
it('should display the template according to the exact value',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
|
@ -35,7 +35,6 @@ import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
import {ListWrapper} from '../../src/facade/collection';
|
||||
import {ObservableWrapper, TimerWrapper} from '../../src/facade/async';
|
||||
import {PromiseWrapper} from '../../src/facade/promise';
|
||||
import {browserDetection} from '@angular/platform-browser/testing';
|
||||
import {dispatchEvent} from '@angular/platform-browser/testing';
|
||||
|
||||
export function main() {
|
||||
@ -1547,8 +1546,7 @@ class LoginIsEmptyValidator {
|
||||
@Directive({
|
||||
selector: '[uniq-login-validator]',
|
||||
providers: [
|
||||
new Provider(NG_ASYNC_VALIDATORS,
|
||||
{useExisting: forwardRef(() => UniqLoginValidator), multi: true})
|
||||
{provide: NG_ASYNC_VALIDATORS, useExisting: forwardRef(() => UniqLoginValidator), multi: true}
|
||||
]
|
||||
})
|
||||
class UniqLoginValidator implements Validator {
|
||||
|
Reference in New Issue
Block a user