您可以覆盖AngularUI引导特定的模板? [英] Can you override specific templates in AngularUI Bootstrap?

查看:153
本文介绍了您可以覆盖AngularUI引导特定的模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇,如果有覆盖从UI的引导,第三方物流企业的文件单个特定模板的方法。绝大多数的默认模板适合我的需要,但有我想不经过抢占了所有的默认模板,并让他们连接到非第三方物流企业版的全过程要更换几个特定的​​人。

I'm curious if there's a way to override single, specific templates from the ui-bootstrap-tpls file. The vast majority of the default templates fit my needs, but there's a couple specific ones I'd like to replace without going through the whole process of grabbing all the default templates and getting them wired up to the non-tpls version.

推荐答案

是的,从 HTTP指令://angular-ui.github .IO /引导是高度可定制的,它很容易忽略的一个模板(仍然依赖于其他指令默认的)。

Yes, directives from http://angular-ui.github.io/bootstrap are highly customizable and it is easy to override one of the templates (and still rely on the default ones for other directives).

有足够养活 $ templateCache ,直接(如 UI的引导,第三方物流企业文件),或者 - 可能更简单 - 使用覆盖模板的<脚本> 指令(的 DOC )。

It is enough to feed $templateCache, either feeding it directly (as done in the ui-bootstrap-tpls file) or - probably simpler - override a template using the <script> directive (doc).

在这里我改变了警报的模板来交换 X 关闭如下所示的人为的例子:

A contrived example where I'm changing alert's template to swap x for Close is shown below:

<!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 class='alert' ng-class='type && "alert-" + type'>
          <button ng-show='closeable' type='button' class='close' 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 class='btn' ng-click="addAlert()">Add Alert</button>
    </div>
  </body>
</html>

直播plunker:<一href=\"http://plnkr.co/edit/gyjVMBxa3fToYTFJtnij?p=$p$pview\">http://plnkr.co/edit/gyjVMBxa3fToYTFJtnij?p=$p$pview

这篇关于您可以覆盖AngularUI引导特定的模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆