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.
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';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With