小编Mag*_*son的帖子

ng2-bootstrap在Angular 2中不起作用('alert'不是已知元素:)

我通过以下方式在运行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)

ng2-bootstrap angular

8
推荐指数
1
解决办法
8397
查看次数

如何使用jQuery(mobile)动态添加<li>元素作为listview

我正在尝试让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"具有相同的格式.

我究竟做错了什么?感谢任何帮助!

/马格努斯

mobile jquery dynamic html-lists

5
推荐指数
1
解决办法
5157
查看次数

标签 统计

angular ×1

dynamic ×1

html-lists ×1

jquery ×1

mobile ×1

ng2-bootstrap ×1