Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了angularjs – 使用UI-Router使用多个视图的空白页面大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我跟着这个 articleother我试图复制维基上的内容,没有任何运气.

到目前为止,这就是我所做的
文件夹结构:

>偏

>指数

> index.html //内部视图
> index.css
> index.js // controller

>页脚

> footer.html
> footer.js

>标题

> //相同的结构

> index.html //主文件

stateProvider:

angular.module('app').config(function($stateProvider,$urlRouterProvider) {
        $stateProvider.state("index",{
            url: "/index",templateUrl:'/partial/index.html',views: {
                'footer@index': {
                    templateUrl: "/partial/header.html",controller:"FooterCtrl"
                },'header@index': {
                    templateUrl: "/partial/header.html",controller: "HeaderCtrl"
                }
            }
    });  
 $urlRouterProvider.otherwise('/index');

编辑:

这是标记

<div>
    <div id="content" class="container">

        <div ui-view="header"></div>
        <div ui-view></div>
        <div ui-view="footer"></div>

    </div>
  </div>

我正在浏览的网址是:localhost:9001 /#/ index

我没有任何错误只是一个空白页面

解决方法

看起来您在templateUrl上使用了不正确的路径.

这是使用ui-router:http://plnkr.co/edit/Nqwlkq1vGh5VTBid4sMv?p=preview的plunker

我还建议阅读http://angular-ui.github.io/ui-router/sample/#/的源代码,它在这里一个抽象的实现,以及关于如何正确使用ui-router的许多评论.

大佬总结

以上是大佬教程为你收集整理的angularjs – 使用UI-Router使用多个视图的空白页面全部内容,希望文章能够帮你解决angularjs – 使用UI-Router使用多个视图的空白页面所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。