【发布时间】:2017-02-04 09:18:42
【问题描述】:
我的服务器端应用程序上有带有 ng-bootstrap 的 Angular2 (2.0.0)。所有的模板都是用 php 渲染的(不是 angular)。
当我从服务器端包含任何 ng-bootstrap sn-p 时,它不起作用。但是,如果我将它们从 <app-root>...</app-root> 中的角度模板中包含在内,那么它就可以工作。
我基本上需要在模板的任何位置包含下拉、模态、警报...作为直接指令样式。这怎么可能?
<body>
<h1>Title 1</h1>
<p>This is para...</p>
<app-root></app-root> <!-- any ng-bootstrap directives are accessable inside app-root -->
<!-- I'm not rendered as ng-bootstrap directive, since its not inside app-root -->
<ngb-alert [dismissible]="false">
<strong>Warning!</strong> Better check yourself, you're not looking too good.
</ngb-alert>
<!--script tags are included here for angular2-->
</body>
【问题讨论】:
-
您需要提供一些具体的代码示例。
-
添加代码示例
-
好吧,把它放在app-root下,否则app-root就不是你的app root了。
-
我怎么能把它放在 app-root 之外,因为 90% 的应用程序和模板是从服务器生成的。
-
我不明白服务器生成模板这一事实如何阻止它生成警报位于应用程序根内部而不是外部的模板。你需要解释一下。
标签: twitter-bootstrap angular angular2-template angular2-directives ng-bootstrap