angular.js - angular ui-router template content is not displayed
迷茫
迷茫 2017-05-15 17:09:48
0
4
711

After looking for errors for a long time, I couldn’t find any problems, and the console didn’t report any errors. I went to read the official documents again, but still didn’t find any.
The page is always blank. Is there anyone who can help me with the same situation? I just started learning Angular.

index.html

app.js

main.html

content.html

I want to add a fixed header and sidebar to main.html, but it never appears and the page is blank.

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(4)
给我你的怀抱

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

洪涛

Why is your main set to abstract?

曾经蜡笔没有小新

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

我想大声告诉你

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template