Dav*_*idL 8 javascript angularjs systemjs bootstrap-tags-input angular
我正在尝试在Angular2项目中使用bootstrap-tagsinput库.使用package.jsonfile 安装库:
"dependencies": {
...
"bootstrap-tagsinput": "^0.7.1",
...
}
Run Code Online (Sandbox Code Playgroud)
现在我有一个bootstrap-tagsinput文件夹node_modules.我想在特定组件中使用tagsinput.我看到目录中有一个bootstrap-tagsinput-angular.js文件node_modules/bootstrap-tagsinput/dist,但我无法正常使用它.
我应该在index.html中添加JS文件,以便bootstrap-tagsinput可用于所有组件吗?或者有没有办法在需要的地方导入它?
换句话说,有没有办法做这样的事情:
mycomponent.component.html:
<input type="text" value="Amsterdam,Washington,Sydney,Beijing,Cairo" data-role="tagsinput"/>
Run Code Online (Sandbox Code Playgroud)
mycomponent.component.ts:
import {Component, AfterViewInit} from '@angular/core';
import {TagsInputComponents} from 'bootstrap-tagsinput'; // Something like that?!?
@Component({
...
})
export class MyComponentComponent implements AfterViewInit {
ngAfterViewInit():any {
$('input').tagsinput('refresh');
}
}
Run Code Online (Sandbox Code Playgroud)
非常感谢你的帮助!
| 归档时间: |
|
| 查看次数: |
5862 次 |
| 最近记录: |