我通过以下方式在运行Angular 2.0.1的项目上安装了ng2-bootstrap:
npm install ng2-bootstrap --save
Run Code Online (Sandbox Code Playgroud)
我设置了这样的项目:
//systemjs.config.js
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
'moment': 'node_modules/moment/moment.js',
'ng2-bootstrap/ng2-bootstrap': 'node_modules/ng2-bootstrap/bundles/ng2-bootstrap.umd.js',
// our app is within the app folder
app: 'app',
// angular bundles
Run Code Online (Sandbox Code Playgroud)
和:
// app.module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { Ng2BootstrapModule } from 'ng2-bootstrap/ng2-bootstrap'; …Run Code Online (Sandbox Code Playgroud) 我正在尝试让jQuery(移动)向数据角色设置为"listview" 添加新<li>元素<ul>
这是html:
<div data-role="page">
<header data-role="header">
<h1>Header</h1>
</header>
<div data-role="content">
<ul data-role="listview" data-theme="a" id="sitelist">
<li><a href="page1.html" data-transition="pop">Page1</a></li>
</ul>
</div>
<footer data-role="footer">
<h4>Footer text</h4>
</footer>
</div>
Run Code Online (Sandbox Code Playgroud)
这是使用的JavaScript:
$('ul').append('<li><a href="#">sada</a></li> ');
$('ul').listview('refresh');
Run Code Online (Sandbox Code Playgroud)
但问题是输出呈现为:http: //www.dumblegroup.com/Capture.png
我希望"sada"项只能呈现一次,它应该与"Page1"具有相同的格式.
我究竟做错了什么?感谢任何帮助!
/马格努斯