search

Home  >  Q&A  >  body text

angular.js - angular ui-router 模板内容不显示

找了半天错误,没发现哪里有问题,控制台也没报错,又跑去看官方文档,还是没有发现。
页面始终是空白的,有没有遇到同样情况的指导一下,刚开始学angular。

index.html

app.js

main.html

content.html

想要在main.html添加固定的头部和侧边栏,可是一直显示不出来,页面都是一片空白。

迷茫迷茫2744 days ago670

reply all(4)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-15 17:11:48

    Check whether the address is written incorrectly in the routing settings. If the page and controller are correct, it is usually a problem with ui-router

    reply
    0
  • PHP中文网

    PHP中文网2017-05-15 17:11:48

    Why is your main set to abstract?

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 17:11:48

    1. Remove the ui-view class in index.html.
    2. In routing, $urlRouterProvider.otherwise('/main');

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-15 17:11:48

    Write like this:

            .state('book', {
                url: '/book',
                template: '<p ui-view></p>',
                abstract: true,
                resolve: {
                    load: ['$ocLazyLoad',
                        function($ocLazyLoad) {
                            return lazyDeferred = $ocLazyLoad.load([{
                                files: [
                                    './css/book.css'
                                ]
                            }, {
                                name: '73go.book',
                                files: [htmlBase + 'book/main.js']
                            }]);
                        }
                    ]
                }
            })
    
            .state('book.list', {
                url: '',
                templateUrl: htmlBase + 'book/list.html',
                data: {
                    title: '需求及方案'
                }
            })

    You don’t need to worry about resolve, it’s a combination with OClazyLoad

    abstract: true, if this is set, the interface will not be displayed. You have set up main

    reply
    0
  • Cancelreply