您可以覆盖AngularUI Bootstrap中的特定模板吗?

您可以覆盖AngularUI Bootstrap中的特定模板吗?,第1张

您可以覆盖AngularUI Bootstrap中的特定模板吗?

是的,来自http://angular-ui.github.io/bootstrap的指令是高度可定制的,并且很容易覆盖其中一个模板(其他模板仍然依赖默认模板)。

只需

$templateCache
通过直接喂食(如在
ui-bootstrap-tpls
文件中完成)或(可能更简单)使用
<script>
指令(doc)覆盖模板,就可以喂食。

在那里我改变了警报的模板来交换一个人为的例子

x
Close
如下所示:

<!doctype html><html ng-app="plunker">  <head>    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js"></script>    <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.4.0.js"></script>    <script src="example.js"></script>    <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">    <script id="template/alert/alert.html" type="text/ng-template">      <div  ng->          <button ng-show='closeable' type='button'  ng-click='close()'>Close</button>          <div ng-transclude></div>      </div>    </script>  </head>  <body>    <div ng-controller="alertDemoCtrl">      <alert ng-repeat="alert in alerts" type="alert.type" close="closealert($index)">       {{alert.msg}}      </alert>      <button  ng-click="addalert()">Add alert</button>    </div>  </body></html>

现场演奏者:http
://plnkr.co/edit/gyjVMBxa3fToYTFJtnij?p=preview



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5673986.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存