atscript

What does the @ (at sign) mean in the latest TypeScript (presumably v1.5) example?

孤者浪人 提交于 2019-12-18 07:29:09
问题 There is a very interesting picture was posted in the official TypeScript blog. I wonder what the @ (at sign) symbol is doing there since (as far as I know) it cannot be used in JavaScript identifiers. 回答1: The big news this week is the merging of AtScript and TypeScript. The following example from the AtScript documentation... @Component() class MyApp { server:Server; @Bind('name') name:string; @Event('foo') fooFn:Function; @Inject() constructor(@parent server:Server) {} greet():string {} }

Global events (window.onresize) didn't change the local variable's value

假装没事ソ 提交于 2019-12-11 11:21:03
问题 Global events (window.onresize) didn't change the local variable's value. export class TestComponent implements OnInit { a: number = 0; b: number = 0; ngOnInit() { window.onresize = () => { this.a = 10; this.b = 10; }; } } 回答1: Bind to global events using host binding (this is mentioned in the API docs, deep inside the DirectiveMetadata page): @Component({ selector: 'my-app', template: `<p>Resize window and look at console log. <p>{{a}} {{b}}` }) export class AppComponent { @HostListener(

Importing anuglar2/forms causing “Cannot read property 'annotations' of undefined”

送分小仙女□ 提交于 2019-12-08 17:34:11
问题 I'm trying to create simple form as described in http://angularjs.blogspot.no/2015/03/forms-in-angular-2.html, but when I add import {forms, required} from 'angular2/forms'; in crashes with TypeError: Cannot read property 'annotations' of undefined TypeError: Cannot read property 'annotations' of undefined at ReflectionCapabilities.System.register.execute.$__export.annotations (http://localhost:9090/node_modules/angular/dist/js/prod/es6/angular2/src/reflection/reflection_capabilities.es6!eval

Visual Studio 2015 Enterprise with ReSharper 10 Ultimate — Cannot be properly resolved

半城伤御伤魂 提交于 2019-11-28 00:40:01
I have Visual Studio 2015 Enterprise, version 14.0.24720.00 Update 1 as well as ReSharper 10 Ultimate, version 10.0.2 installed. I have a typescript file that is using AtScript syntax to refer to the Angular2 directive module, as its annotation. However, ReSharper is stating the following error: Symbol 'Directive' cannot be properly resolved, probably it is located in inaccessible module. Below is the full error tooltip. The application compiles and runs as expected, and the angular portions of the application also function as desired. It appears as though this is a ReSharper false negative.

Visual Studio 2015 Enterprise with ReSharper 10 Ultimate — Cannot be properly resolved

爱⌒轻易说出口 提交于 2019-11-27 04:44:27
问题 I have Visual Studio 2015 Enterprise, version 14.0.24720.00 Update 1 as well as ReSharper 10 Ultimate, version 10.0.2 installed. I have a typescript file that is using AtScript syntax to refer to the Angular2 directive module, as its annotation. However, ReSharper is stating the following error: Symbol 'Directive' cannot be properly resolved, probably it is located in inaccessible module. Below is the full error tooltip. The application compiles and runs as expected, and the angular portions