Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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):

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

'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'
  });

})();

Any help will be appreciated.

like image 891
nash Avatar asked Sep 02 '16 10:09

nash


1 Answers

Make sure that you manually import your new component into your app.js file inside of your client/app/ folder. Like so:

import main from './{your_component}/{your_component}.component';
like image 76
Tiffany Lowe Avatar answered Oct 17 '22 01:10

Tiffany Lowe