Yeoman Angular-Fullstack 新路由不重定向

Yeoman Angular-Fullstack new route does not redirect

我正在使用 angular-fullstack 生成器来开发我的项目。当我尝试使用命令创建新路由时(我已经安装了 uiRouter):

yo angular-fullstack:route search

所有文件创建成功。但是每当我尝试打开该路由时,我都会被重定向回主页。配置是这样自动生成的:

search.js

'use strict';

angular.module('tachologyApp')
  .config(function ($stateProvider) {
    $stateProvider
      .state('search', {
        url: '/search',
        template: '<search></search>'
      });
  });

search.controller.js

'use strict';

(function(){

class SearchComponent {
  constructor() {
    this.message = 'Hello';
  }
}

angular.module('tachologyApp')
  .component('search', {
    templateUrl: 'app/search/search.html',
    controller: SearchComponent,
    controllerAs: 'searchCtrl'
  });

})();

我们将不胜感激。

确保您手动将新组件导入到 client/app/ 文件夹内的 app.js 文件中。像这样:

import main from './{your_component}/{your_component}.component';