简体   繁体   中英

Angular 2 typescript reference path

I've been trying to set up a working environment for angular 2 projects using Typescript and Visual Studio 2013. So far I've been following this tutorial link - but I'm still getting the common error that the experimental decorators are showing an error. I'm at the step in the tutorial where I need to write these lines

/// <reference path="node_modules/angular2/bundles/typings/es6-shim/es6-shim.d.ts" />
/// <reference path="node_modules/angular2/bundles/typings/angular2/angular2.d.ts" />

In the app.ts file. Maybe this tutorial was written a while ago because these paths don't match the folder structure I have in my node_modules folder and I can't seem to find the matching files. My question is, have these files changed names? Is it possible to just give the broader file path and have VS look the files up or something? How do I fix this?

Thank you so much for your patience... I just can't get wait to get through this annoying environment setup and get to actual coding.

You have to use a relative to your current script path. Try something like this:
/// <reference path="../node_modules/angular2/bundles/typings/es6-shim/es6-shim.d.ts" />
/// <reference path="../node_modules/angular2/bundles/typings/angular2/angular2.d.ts" />
Of course that depends on the location of the script in which you call it. In my example the script will be located in a directory on the same level as the node_modules directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM