我试图在VS项目中导入ng2-bootstrap模块。 我拿这个github repo,它在将"moment": "2.11.2"
加到tsconfig.json
之后成功启动。visual studio 2015中的ng2-bootstrap模块
在VS我做的差不多,把"ng2-bootstrap": "1.0.5", "moment": "2.11.2"
加到tsconfig.json
,VS恢复到Dependencies
。然后用gulp
我将ng2-bootstrap.min.js, moment.js
移动到根应用程序目录,并将其绑定到index.html
和moment.js
map.in system.js配置为map: { moment: 'libs/moment.js }
。
添加Alert组件到我的角class
后:
import {Component, OnInit} from 'angular2/core'
import {Router} from 'angular2/router'
import {HeroService} from './hero.service'
import {User} from './user'
import {Alert} from 'ng2-bootstrap/ng2-bootstrap'
//declare var jwt_decode: any;
@Component({
selector: 'login',
templateUrl: 'app/login.component.html',
styleUrls: ['app/login.component.css', 'app/css/bootstrap.css', 'app/css/styles.css'],
directives: [Alert]
})
构建之后我采取以下错误:
Error TS2307 Build: Cannot find module 'moment'. ASPAngular2Test E:\Development\C#\ASP.NET\ASPAngular2Test\src\ASPAngular2Test\node_modules\ng2-bootstrap\components\datepicker\date-formatter.ts 1
我插入此<script src="libs/moment.js"></script>
到我index.html
和date-formatter.ts
声明变量等declare var moment: any
,错误消失,但建立后引导tags
没有任何效果。
而在神秘的方式我被编译node_modules/ng2-bootstrap
和我所有的ts
文件wwwroot/app/scripts
目录。我用wwwroot/app/
替换编译的js
文件,但它也没有效果。我的应用程序没有看到ng2-bootstrap
组件的本机属性。也许有人遇到这种问题?