不能这样做 - 从'ngx-bootstrap'导入{AlertModule};

时间:2017-08-16 15:55:46

标签: angular bootstrap-4

我很抱歉,但我是棱角分明的新手并且一直关注视频教程,我似乎做了一切正确的事情但是当我根据需要添加了bootstrap时

npm install ngx-bootstrap bootstrap --save

然后

Sub RegexTest()

    Dim strInput As String
    Dim strPattern As String

    strInput = "9129 Nor22 999123456 South92345West"

    'strPattern = "^\d{5}$"  'No match

    strPattern = "[^\d]\d{5}[^\d]" 'Returns additional letter before and after digits
                                     'In this case returns:  "h12345W"

    MsgBox RegxFunc(strInput, strPattern)

End Sub


Function RegxFunc(strInput As String, regexPattern As String) As String

    Dim regEx As New RegExp
    With regEx
        .Global = True
        .MultiLine = True
        .IgnoreCase = False
        .Pattern = regexPattern
    End With


    If regEx.test(strInput) Then
        Set matches = regEx.Execute(strInput)
        RegxFunc = matches(0).Value
    Else
        RegxFunc = "not matched"
    End If

End Function

还添加了样式----

open src/app/app.module.ts and add

import { AlertModule } from 'ngx-bootstrap';

and also added--

imports: [
    BrowserModule,
    AlertModule
  ],

我整整一天都在尝试,但一直收到这个错误 -

错误在D:/ng-gallery/gallery/src/app/app.module.ts(6,29):找不到模块'ngx-bootstrap'。

"styles": [
        "styles.css",
        "../node_modules/bootstrap/dist/css/bootstrap.min.css"
      ],

任何人都可以指导我......

此致

1 个答案:

答案 0 :(得分:2)

您将需要引导样式(Bootstrap 3)

<!-- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

或Bootstrap 4

<!--- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">

要在ngx-bootstrap中启用bootstrap 4主题模板,请阅读 here

打开src/app/app.module.ts并添加

import { AlertModule } from 'ngx-bootstrap';...
@NgModule({
...
imports: [AlertModule.forRoot(), ... ],
... 
})

打开.angular-cli.json并在样式数组中插入一个新条目

"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css",
],

打开src/app/app.component.html并添加

<alert type="success">hello</alert>