Search Posts

Category: angular-ui-router

Angularjs after using ‘location replace’, duplicated pages remained

In my code, logics are executed like belows. Showing items list in main page. Click one item and move to detail page. I wanna change something, so click edit button and move to edit page Edit some and finish editing with click the confirm button. When click the button, execute $state.go(toGo, params, {location: ‘replace’}); Then move to detail page. Through these, location history has successive detail page How can I remove this successive pages in […]

Error: [$injector:unpr] Transition Rejection

I’ve been working on a coding project for a class I am taking on Angular JS. I ran into the Error: [$injector:unpr] (specific error below) and I looked on stack overflow and the Angular JS website but couldn’t find the fix. Please help and thank you in advance. The code and errors are below. PS: I’m using angular-ui-router version 1.0.3 and angularjs version 1.6.5 Error Transition Rejection($id: 0 type: 6, message: The transition errored, detail: […]

Cannot inject provider

Angular 1.6 I develop a dashboard application. There are two statically defined ui.router states for the registered dashboard components: home-dashboard and other-dashboard. Now I want to define ui.router states dynamically based on dashboards data. For this, I do a loop inside app.config. But in order to get dashboards data, StorageService provider should be injected into the config. The error received is: Error: [$injector:unpr] Unknown provider: StorageService How to inject provider? Is there a better way […]

Dynamic Routes loading throwing error "No Factory found"

Hi I am trying to load routes dynamically returned by API server. But I get error “No Component factory found for component”.I have my components added in entryComponent here is my code. error: Uncaught (in promise): Error: No component factory found for ParentComponent. Did you add it to @NgModule.entryComponents? Error: No component factory found for ParentComponent. Did you add it to @NgModule.entryComponents? at noComponentFactoryError (core.es5.js:3202) at CodegenComponentFactoryResolver.webpackJsonp…/../../core/@angular/core.es5.js.CodegenComponentFactoryResolver.resolveComponentFactory (core.es5.js:3267) at RouterOutlet.webpackJsonp…/../../router/@angular/router.es5.js.RouterOutlet.activateWith (router.es5.js:5614) at ActivateRoutes.webpackJsonp…/../../router/@angular/router.es5.js.ActivateRoutes.activateRoutes (router.es5.js:4749) at […]

Directly redirect to a page based on some condition

I have already a home page, now I want to add a homePlus page controlled by a localStorage variable alreadyShown. The setting is, after homePlus is displayed for the first time, we set alreadyShown to true, as a result all the later loading of homePlus will directly redirect to the home page. I have the following code: .state(‘homePlus’, { url: ‘/homePlus’, templateUrl: ‘/htmls/homePlus.html’, controller: ‘homePlusCtrl’, resolve: { checkAlready: [‘$window’, function ($window) { if ($window.localStorage[‘alreadyShown’] === […]

AngularJS – ui-routing with ng-click not working properly

I’m using ui-router for creating some routes and I’m getting this very weird thing happening. I have this route config .state(‘chapter_route’, { url: ‘/book/:chap’, templateUrl: “views/chapter.html”, params: { chap: null} }) So when I clink on: <a ui-sref=”chapter_route({ chap: getChapter.title})”>CHAPTER:</a> It redirects me, as I wanted, to this following ui-view: <div class=”panel panel-default”> <div class=”panel-body”> <p>{{getChapter.title}}</p> {{getChapter.content}} </div> </div> …… …… <div class=”panel panel-default” data-ng-repeat=”cha in allChapters”> <div class=”panel-body”> <a ui-sref=”chapter_route({ chap: cha.title})” ng-click=”changeChapter(chap)”>{{cha.title}}</a> {{cha.content […]

Angular – ui-router states not recognized

I’m developing Spring + Angular JS web application. Project has following structure: app.state.js (function() { ‘use strict’; angular .module(‘ftnApp’) .config(stateConfig); stateConfig.$inject = [‘$stateProvider’]; function stateConfig($stateProvider) { $stateProvider.state(‘app’, { abstract: true, views: { ‘[email protected]’: { templateUrl: ‘app/layouts/navbar/navbar.html’, controller: ‘NavbarController’, controllerAs: ‘vm’ } } }); }})(); app.module.js (function() { ‘use strict’; angular .module(‘ftnApp’, [ ‘ngStorage’, ‘ngResource’, ‘ngCookies’, ‘ngAria’, ‘ngCacheBuster’, ‘ngFileUpload’, ‘ui.bootstrap’, ‘ui.bootstrap.datetimepicker’, ‘ui.router’, ‘infinite-scroll’, ‘angular-loading-bar’ ]);})(); home.state.js (function() { ‘use strict’; angular .module(‘ftnApp’) .config(stateConfig); stateConfig.$inject = [‘$stateProvider’]; […]

generator-angular-fullstack and UI Router resolve

I used the generator-angular-fullstack to create an Angular 1.6 application and I can’t get the value of my resolve in UI Router. I tried to use it like this: Route: $stateProvider.state(‘main’, { url: ‘/’, template: ‘<main></main>’, resolve: { test: function() { return ‘test’ } } }); Controller constructor($state, socket, localStorageService, test) { } Which lead to an unknow provider error. And this way: Route: $stateProvider.state(‘main’, { url: ‘/’, template: ‘<main test=”$resolve.test”></main>’, resolve: { test: function() […]

Next Page »