加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – Angular ui bootstrap指令模板丢失

发布时间:2020-12-17 09:05:00 所属栏目:安全 来源:网络整理
导读:我目前正在测试本地在我的机器上的角度bootstrap-UI。当我尝试重新创建手风琴和对话框的例子。我在控制台中收到此错误消息,说模板丢失。 Example of error: 404 Not Found – localhost/angular/template/message.html 当我看到ui-bootstrap-0.1.0.js指令有
我目前正在测试本地在我的机器上的角度bootstrap-UI。当我尝试重新创建手风琴和对话框的例子。我在控制台中收到此错误消息,说模板丢失。

Example of error:
404 Not Found – localhost/angular/template/message.html

当我看到ui-bootstrap-0.1.0.js指令有一个模板URL。

templateURL的指令的目的是什么?

当我下载整个角度的bootstrap-UI zip文件时,是否包括那些模板?

我缺少我应该包括在我的标题中的其他文件?

<link rel="stylesheet" href="includes/css/bootstrap.css">
<script src="includes/js/angular.js"></script>
<script src="includes/js/ui-bootstrap-0.1.0.js"></script>
您有两个选择:

>如果你不想制作自己的模板并想要内置的模板,你应该下载ui-bootstrap-tpls-0.1.0.js文件 – 这会注入所有的模板,这样他们就被预先缓存到你的应用程序:https://github.com/angular-ui/bootstrap/blob/gh-pages/ui-bootstrap-tpls-0.1.0.js#L1322
>如果你想做一些自己的模板,在你的应用程序中创建一个模板文件夹,并从angular-ui / bootstrap项目下载模板。然后覆盖您想自定义的那些。

阅读更多:https://github.com/angular-ui/bootstrap/tree/gh-pages#build-files

编辑:

你也可以下载bootstrap-tpls.js,并且仍然使用你自己的方法覆盖一些指令的templateUrls,使用AngularJS装饰器来改变指令的templateUrl。这里是一个例子,更改的datepicker的templateUrl:

http://docs.angularjs.org/api/AUTO.$provide#methods_decorator

myApp.config(function($provide) {
  $provide.decorator('datepickerDirective',function($delegate) {
    //we now get an array of all the datepickerDirectives,//and use the first one
    $delegate[0].templateUrl = 'my/template/url.html';
    return $delegate;
  });
});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读