单击链接时AngularJS UI视图路由不起作用

时间:2018-09-17 06:38:38

标签: angularjs angular-ui-router

当我单击“舔”时,我在这里使用Angular ui-routing函数url正在像this这样的url栏中扩展

ANgularCtrl是

    var app = angular.module('MyApp', ['ui.router'])
app.config(['$qProvider', '$stateProvider', function ($qProvider, $stateProvider) {
    $qProvider.errorOnUnhandledRejections(false);
    var Custstate = {
        name: 'Customer',
        url: 'Views/Customer/Customer.html',
    }
    $stateProvider.state(Custstate);
}])

UI视图是

 <a ui-sref="Customer" ui-sref-active="active">Customer</a>
    <ui-view></ui-view>

1 个答案:

答案 0 :(得分:0)

处于这样的配置寄存器状态。

var routerApp = angular.module('MyApp', ['ui.router']);

routerApp.config(function($stateProvider, $urlRouterProvider) {
    $stateProvider
    .state('Customer', {
        url: '/Customer',
        templateUrl: 'Views/Customer/Customer.html'
    });

});

有关更多详细信息,请参见https://scotch.io/tutorials/angular-routing-using-ui-router