简体   繁体   English

Yeoman Angular-Fullstack新路线未重定向

[英]Yeoman Angular-Fullstack new route does not redirect

I'm using angular-fullstack generator to develop my project. 我正在使用角度全堆栈发生器来开发我的项目。 When I try to create a new route using the command (I've installed uiRouter): 当我尝试使用命令创建新路由时(我已安装uiRouter):

yo angular-fullstack:route search

All the files are created successfully. 所有文件创建成功。 But whenever I try to open that route, I get redirected back to the home page. 但是,每当我尝试打开那条路线时,我都会被重定向回主页。 The config is autogenerated like this: 像这样自动生成配置:

search.js search.js

'use strict';

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

search.controller.js 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'
  });

})();

Any help will be appreciated. 任何帮助将不胜感激。

Make sure that you manually import your new component into your app.js file inside of your client/app/ folder. 确保您将新组件手动导入到client / app /文件夹内的app.js文件中。 Like so: 像这样:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM