UNPKG

angular2

Version:

Angular 2 - a web framework for modern web apps

104 lines 3.56 kB
'use strict';var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var exceptions_1 = require("angular2/src/facade/exceptions"); /** * An error thrown if application changes model breaking the top-down data flow. * * This exception is only thrown in dev mode. * * <!-- TODO: Add a link once the dev mode option is configurable --> * * ### Example * * ```typescript * @Component({ * selector: 'parent', * template: ` * <child [prop]="parentProp"></child> * `, * directives: [forwardRef(() => Child)] * }) * class Parent { * parentProp = "init"; * } * * @Directive({selector: 'child', inputs: ['prop']}) * class Child { * constructor(public parent: Parent) {} * * set prop(v) { * // this updates the parent property, which is disallowed during change detection * // this will result in ExpressionChangedAfterItHasBeenCheckedException * this.parent.parentProp = "updated"; * } * } * ``` */ var ExpressionChangedAfterItHasBeenCheckedException = (function (_super) { __extends(ExpressionChangedAfterItHasBeenCheckedException, _super); function ExpressionChangedAfterItHasBeenCheckedException(exp, oldValue, currValue, context) { _super.call(this, ("Expression '" + exp + "' has changed after it was checked. ") + ("Previous value: '" + oldValue + "'. Current value: '" + currValue + "'")); } return ExpressionChangedAfterItHasBeenCheckedException; })(exceptions_1.BaseException); exports.ExpressionChangedAfterItHasBeenCheckedException = ExpressionChangedAfterItHasBeenCheckedException; /** * Thrown when an expression evaluation raises an exception. * * This error wraps the original exception to attach additional contextual information that can * be useful for debugging. * * ### Example ([live demo](http://plnkr.co/edit/2Kywoz?p=preview)) * * ```typescript * @Directive({selector: 'child', inputs: ['prop']}) * class Child { * prop; * } * * @Component({ * selector: 'app', * template: ` * <child [prop]="field.first"></child> * `, * directives: [Child] * }) * class App { * field = null; * } * * bootstrap(App); * ``` * * You can access the original exception and stack through the `originalException` and * `originalStack` properties. */ var ChangeDetectionError = (function (_super) { __extends(ChangeDetectionError, _super); function ChangeDetectionError(exp, originalException, originalStack, context) { _super.call(this, originalException + " in [" + exp + "]", originalException, originalStack, context); this.location = exp; } return ChangeDetectionError; })(exceptions_1.WrappedException); exports.ChangeDetectionError = ChangeDetectionError; /** * Thrown when change detector executes on dehydrated view. * * This error indicates a bug in the framework. * * This is an internal Angular error. */ var DehydratedException = (function (_super) { __extends(DehydratedException, _super); function DehydratedException() { _super.call(this, 'Attempt to detect changes on a dehydrated detector.'); } return DehydratedException; })(exceptions_1.BaseException); exports.DehydratedException = DehydratedException; //# sourceMappingURL=exceptions.js.map