Javascript AngularJS用户友好配置文件

Javascript AngularJS用户友好配置文件,javascript,angularjs,angular-ui-router,Javascript,Angularjs,Angular Ui Router,我的安格拉斯路线有麻烦了。我有以下代码:我不知道如何添加短配置文件,如: 有什么提示吗?看起来您找到的链接是用于使用内置的ng route指令的,但您已经用angular ui router标记了这个问题。这就是使用ui路由器配置应用程序时的配置 angular.module('myApp', ['ui.router']) .config(function ($stateProvider) { // Configure my routes with ui-router $st

我的安格拉斯路线有麻烦了。我有以下代码:我不知道如何添加短配置文件,如:


有什么提示吗?

看起来您找到的链接是用于使用内置的ng route指令的,但您已经用angular ui router标记了这个问题。这就是使用ui路由器配置应用程序时的配置

angular.module('myApp', ['ui.router'])
  .config(function ($stateProvider) {
    // Configure my routes with ui-router
    $stateProvider
      .state('user-profile', {
        url: '/:username',
        templateUrl: 'app/profiles/template.html',
        controller: 'UserProfileCtrl',
        controllerAs: 'upCtrl'
      })
      // These are nested states, under `user-profile`
      .state('user-profile.images', {
        template: '<div my-images-directive></div>'
      })
      .state('user-profile.friends', {
        template: '<div my-friends-directive></div>'
      })
      .state('otherPage', {
        url: '/other-page',
        templateUrl: 'app/otherpage/template.html'
      });
  });

要摆脱散列,您需要使用
$locationProvider打开HTML5模式。HTML5模式(true)

请将您的代码移到您的问题中。谢谢。试着添加你的代码,也许我们能帮上忙you@delco-这对你有帮助吗?请提供一些反馈不起作用:(未捕获错误:[$injector:modulerr]哪个模块加载失败?您是否插入了ui路由器
angular.module('myApp',['ui.router'])
?页面上是否包含ui路由器的文件?
$state.go('user-profile', {username: $scope.user.name});