8

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.

nash
  • 523
  • 1
  • 5
  • 18
  • I too have this issue. – ChainFuse Sep 27 '16 at 03:24
  • @TiffanyLowe, it seems weird, but I solved it just restarting the computer... (maybe only the server could work too) – nash Sep 28 '16 at 09:47
  • can you mark my answer as fixed? It seems that angular-fullstack fails to inject the import into the app.js file. I'm not sure why it works for you by restarting the computer, but other people who have had this error have solved this problem with my solution. – ChainFuse Oct 03 '16 at 22:44

1 Answers1

3

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';
ChainFuse
  • 797
  • 2
  • 10
  • 26