Angular2 + ng-bootstrap示例

时间:2016-09-01 06:32:31

标签: javascript twitter-bootstrap angular ng-bootstrap

我开始学习Angular2,我想在我的项目中使用ng-bootstrap。但是,我无法做一个有效的项目。导入ng-bootstrap时失败。由于我是初学者,我不知道问题是由于代码还是其他我做错了。

你能为我提供一个使用ng-bootstrap和Angular2的工作和简单项目吗?所以我可以尝试让它在我的电脑上运行?

编辑:

app.module.ts:

    Public Sub Categories()
    Dim Connect As New SqlConnection
    Dim Adapter As New SqlDataAdapter
    Dim DataTable As New System.Data.DataTable
    Dim Query As String
    ConnectionString = "Data Source=LUSPOC-PC;Initial Catalog=Sales_Invnetory;Integrated Security=True"
    Connect = New SqlConnection(ConnectionString)
    Connect.Open()
    Connect.ChangeDatabase("Sales_Inventory")
    Query = "select Column_name from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='Table_Categories'"
    Adapter.SelectCommand = New SqlCommand(Query, Connect)

    Adapter.Fill(DataTable)
    Admin.items_category_combobx.DataSource = DataTable
    Admin.items_category_combobx.DisplayMember = "Column_name"
    Admin.items_category_combobx.ValueMember = "Column_name"




End Sub

systemjs.config.js:

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import { AppComponent }  from './app.component';
import { NgbdAlertCloseable } from './ngbd-alert-closeable.component';


@NgModule({
  imports:      [ NgbModule, BrowserModule ],
  declarations: [ NgbdAlertCloseable, AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

错误:

error

1 个答案:

答案 0 :(得分:7)

我改变了

'ng-bootstrap':       { main: 'index.js', defaultExtension: 'js' } 

将systemjs.config.js中的行作为

'@ng-bootstrap/ng-bootstrap':         { main: 'index.js', defaultExtension: 'js' }

它有效!