-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Directive not working when registered with a TypeScript class variable #11401
Comments
This happens because (in ES6) functions (which is what Thus, You could use a differently named property (e.g. |
Oh.. well.. maybe this is something the typescript compiler should tell me. (at least warn) So basically if I would name the directive class in a camel case fashion like Thanks for the hint. I wasn't even aware that there are properties in ES6 which are shadowing own declarations. Thinking along the lines of "normal javascript" I would have thought I would overwrite the property if it existed. EDIT: But wait a second - I'm running this code in the latest chrome, transpiling to ES5 - is there already running ES6 in my browser without me knowing (when not using a ES6 class declaration but a function)? EDIT2: Nevermind - it is meant for functions not classes so I guess: Yes, Chrome will run this code with ES6 when it is capable of doing so. |
@reppners: I don't think there is something special about the E.g.: var obj = {};
Object.defineProperty(obj, 'test', {value: 'foo', writable: false});
obj.test; // returns: 'foo'
obj.test = 'bar'; // returns: 'bar'
obj.test; // return: 'foo' |
Inspired by some ng-conf videos I've written a directive with a TypeScript class.
When I set the directive name that I want to use to register the directive in a class variable the directive ceases to work.
When using this convention for modules and controllers it is working.
Here is a demo
The text was updated successfully, but these errors were encountered: