我已下载示例https://github.com/tastejs/todomvc/tree/master/examples/typescript-angular,并尝试在VS2013 Web应用程序空模板下运行它。 我添加了样本的所有文件,我通过IIS启动网站,它工作正常。
但是当我构建项目(没有修改任何东西)时,剩下的唯一行是:
/// <reference path='_all.ts' />
/**
* The main TodoMVC app module.
*
* @type {angular.Module}
*/
var todos;
(function (todos) {
'use strict';
var todomvc = angular.module('todomvc', []).controller('todoCtrl', todos.TodoCtrl).directive('todoBlur', todos.todoBlur).directive('todoFocus', todos.todoFocus).service('todoStorage', todos.TodoStorage);
})(todos || (todos = {}));
当我尝试运行网站时,出现以下错误:
http://localhost/WebAppTodoMvc/bower_components/angular/angular.js
0x800a139e - Erreur d’exécution JavaScript: [$injector:modulerr] Failed to instantiate module todomvc due to
Error: [ng:areq] Argument 'directiveFactory' is required
答案 0 :(得分:1)
该代码适用于--out
编译器标记,您应该使用_all.js
https://github.com/tastejs/todomvc/blob/master/examples/typescript-angular/js/_all.ts生成的all.ts
您可以从项目属性中将其指定为参考文件。