How to use Angularjs with TypeScript

I want to use Angularjs with TypeScript .

To solve TS2095: Could not find symbol 'angular' error, I downloaded ts files from here and added references to controllers.ts like this:

/// <reference path="angular.d.ts" />
/// <reference path="jquery.d.ts" />
var mathML = angular.module('mathML', []);

But I still have similar error like this:

angular.d.ts(33,28): error TS2095: Could not find symbol 'JQuery'.

How can I solve this error? Is there better way to setup environment to use Angularjs with TypeScript ?


Using the following directory structure :

|- angular
    |- angular.d.ts
|- jquery
    |- jquery.d.ts
|- mathML.ts

I was able to get the following sample code to compile without errors.

/// <reference path="angular/angular.d.ts" />
var mathML = angular.module('mathML', []);

The angular.d.ts file references the jquery.d.ts file using a relative path. The directory structure is pretty standard for typescript code.

链接地址: http://www.djcxy.com/p/79886.html

上一篇: 在不安装Visual Studio的情况下获取Windows崩溃的堆栈跟踪? (C ++)

下一篇: 如何在TypeScript中使用Angularjs