离子 - 如何正确路由到目标模板?

时间:2017-03-14 10:15:06

标签: angularjs ionic-framework

我尝试使用here中的模板构建应用。我试图创建一个登录页面,但不知何故,渲染的模板不是我想要的。

这是我根据layout.route.js

制作的login.route.js
(function() {
    'use strict';

    angular
        .module('starter.login')
        .run(appRun);

    appRun.$inject = ['routerHelper'];

    function appRun(routerHelper) {
        routerHelper.configureStates(getStates());
    }

    function getStates() {
        return [
            {
                state: 'login',
                config: {
                    url: '/login',                      
                    templateUrl: 'login/login.html'
                }
            }
        ];
    }
})();

这里是app.module.js

(function() {

    'use strict';

    angular
        .module('starter', [
            /* Shared modules */
            'ionic',
            'starter.core',
            'starter.login',
            'starter.layout',
            /* Feature areas */
            'starter.account',
            'starter.chat',
            'starter.dash'
        ]);
})();

此呈现的显示是标签布局。当我删除其他模块时,只留下ionic, starter.core, starter.login,渲染的显示是一个空白页面。但是,当我更改templateUrl中的layout.route.js时,它会呈现我想要的页面。

function getStates() {
        return [
            {
                state: 'tab',
                config: {
                    url: '/tab',
                    abstract: true,                 
                    templateUrl: 'login/login.html'
                }
            }
        ];
    }

如何从login/login.html路由到login.route.js

0 个答案:

没有答案