angular2
Version:
Angular 2 - a web framework for modern web apps
81 lines • 3.31 kB
JavaScript
;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');
/**
* Represents a location in a View that has an injection, change-detection and render context
* associated with it.
*
* An `ElementRef` is created for each element in the Template that contains a Directive, Component
* or data-binding.
*
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
* element.
*/
var ElementRef = (function () {
function ElementRef() {
}
Object.defineProperty(ElementRef.prototype, "nativeElement", {
/**
* The underlying native element or `null` if direct access to native elements is not supported
* (e.g. when the application runs in a web worker).
*
* <div class="callout is-critical">
* <header>Use with caution</header>
* <p>
* Use this API as the last resort when direct access to DOM is needed. Use templating and
* data-binding provided by Angular instead. Alternatively you take a look at {@link Renderer}
* which provides API that can safely be used even when direct access to native elements is not
* supported.
* </p>
* <p>
* Relying on direct DOM access creates tight coupling between your application and rendering
* layers which will make it impossible to separate the two and deploy your application into a
* web worker.
* </p>
* </div>
*/
get: function () { return exceptions_1.unimplemented(); },
enumerable: true,
configurable: true
});
;
Object.defineProperty(ElementRef.prototype, "renderView", {
get: function () { return exceptions_1.unimplemented(); },
enumerable: true,
configurable: true
});
return ElementRef;
})();
exports.ElementRef = ElementRef;
var ElementRef_ = (function (_super) {
__extends(ElementRef_, _super);
function ElementRef_(parentView,
/**
* Index of the element inside the {@link ViewRef}.
*
* This is used internally by the Angular framework to locate elements.
*/
boundElementIndex, _renderer) {
_super.call(this);
this.parentView = parentView;
this.boundElementIndex = boundElementIndex;
this._renderer = _renderer;
}
Object.defineProperty(ElementRef_.prototype, "renderView", {
get: function () { return this.parentView.render; },
set: function (value) { exceptions_1.unimplemented(); },
enumerable: true,
configurable: true
});
Object.defineProperty(ElementRef_.prototype, "nativeElement", {
get: function () { return this._renderer.getNativeElementSync(this); },
enumerable: true,
configurable: true
});
return ElementRef_;
})(ElementRef);
exports.ElementRef_ = ElementRef_;
//# sourceMappingURL=element_ref.js.map