fix(NgSwitch): display deprecation message only once
This commit is contained in:
parent
638fd744aa
commit
398060d5ff
@ -5,6 +5,9 @@ import {isBlank, isPresent, normalizeBlank} from '../facade/lang';
|
|||||||
|
|
||||||
const _CASE_DEFAULT = /*@ts2dart_const*/ new Object();
|
const _CASE_DEFAULT = /*@ts2dart_const*/ new Object();
|
||||||
|
|
||||||
|
// TODO: remove when fully deprecated
|
||||||
|
let _warned: boolean = false;
|
||||||
|
|
||||||
export class SwitchView {
|
export class SwitchView {
|
||||||
constructor(
|
constructor(
|
||||||
private _viewContainerRef: ViewContainerRef, private _templateRef: TemplateRef<Object>) {}
|
private _viewContainerRef: ViewContainerRef, private _templateRef: TemplateRef<Object>) {}
|
||||||
@ -179,9 +182,6 @@ export class NgSwitchCase {
|
|||||||
_value: any = _CASE_DEFAULT;
|
_value: any = _CASE_DEFAULT;
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_view: SwitchView;
|
_view: SwitchView;
|
||||||
// TODO: remove when fully deprecated
|
|
||||||
/** @internal */
|
|
||||||
_warned: boolean;
|
|
||||||
private _switch: NgSwitch;
|
private _switch: NgSwitch;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -197,8 +197,8 @@ export class NgSwitchCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set ngSwitchWhen(value: any) {
|
set ngSwitchWhen(value: any) {
|
||||||
if (!this._warned) {
|
if (!_warned) {
|
||||||
this._warned = true;
|
_warned = true;
|
||||||
console.warn('*ngSwitchWhen is deprecated and will be removed. Use *ngSwitchCase instead');
|
console.warn('*ngSwitchWhen is deprecated and will be removed. Use *ngSwitchCase instead');
|
||||||
}
|
}
|
||||||
this._switch._onCaseValueChanged(this._value, value, this._view);
|
this._switch._onCaseValueChanged(this._value, value, this._view);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user