angular-ui-router

UI-Router: URL changes, but view is not loaded

馋奶兔 提交于 2019-12-13 01:59:08
问题 I have the following code for my router: .config(['$stateProvider', '$urlRouterProvider', '$locationProvider', function($stateProvider, $urlRouterProvider, $locationProvider) { $stateProvider .state('main', { url: '/', templateUrl: 'templates/main.html', controller: 'MainCtrl' }) .state('login', { url: '/login', templateUrl: 'templates/login.html', }) .state('signup', { url: '/signup', templateUrl: 'templates/signup.html', controller: 'SignupCtrl' }) .state('userEdit', { url: '/user/edit',

Routing wierdness in angular with ui-routing

三世轮回 提交于 2019-12-13 01:27:34
问题 Another question guys :) If I leave the templateUrl empty in my routing, the scope is queriable but no template showing. But if I write it just as in the linked plunker project, it makes the links unclickable :( but just for the li > a elements... also in plunker I cannot make it workable, don't know why... anyone? http://plnkr.co/edit/VKhhcSmepMTxBT7R5AuO And here is the ap.js itself for helping (function(){ var portApp = angular.module('portApp', ['ui.router']); portApp.config(function(

UI-Router routing in the same view (View and Edit)

人盡茶涼 提交于 2019-12-13 01:09:43
问题 I'm not able to change the state from view page to edit page and vice versa in UI-Router. Things I've tried: Controller: $stateProvider .state('showViewA', { views: { " ": { template: "default.html", controller:"DefaultController.ts" }, "viewB@showViewA": { template: "viewPage.html", controller:"DefaultController.ts" } } }) .state('showViewA@EditshowViewA', { views: { " ": { template: "defaultEdit.html", controller:"DefaultEditController.ts" } } }) .state('showViewA@ViewshowViewA', { views: {

With defaulted parameters how do I rewrite the url?

六月ゝ 毕业季﹏ 提交于 2019-12-13 01:08:56
问题 I have a route that has an optional parameter of a date in the format YYYY-MM-DD . If a date is not supplied, I will supply today's date. I defined my route like so: .state('some.report', { url: '/report/:reportDate', templateUrl: 'app/report/report.html', params:{reportDate:moment().format('YYYY-MM-DD')}, controller: 'reportCtrl', }) This works, the parameter in the controller is indeed today's date, but the url remains as http://local/some/report/ How can I change it so that url becomes::

UI-Router: create rules to prevent access to a state

倖福魔咒の 提交于 2019-12-13 00:49:02
问题 In UI-router FAQ, they suggested some way for preventing access to some states based on data.rule method of states. Assuming current user is determined by some $currentUser service. However this assumption doesn't seem to be true in real world use cases. Because normally this $currentUser service is implemented in a way that it queries current user from the server and probably the best it can return is a promise of the current user. Therefore, at the moment that $stateChangeStart event is

ui-router creating nested states dynamically

为君一笑 提交于 2019-12-13 00:34:52
问题 I am creating a vertical navigation panel for my web page (a very basic task). Considering different user roles should have different nav-items against the authorization module on the server, it is desired to create the navigation contents dynamically rather than statically, by getting the data from the server. I'm trying to use the UI Router to create nested states dynamically (which is really a natural idea called "divide-and-conquer") but got a problem (I described it in another thread but

How to configure controllers for stateprovider with TypeScript

泄露秘密 提交于 2019-12-13 00:29:56
问题 Let's assume I have following simplified controller: module App { "use strict"; export class StoreDetailController { constructor() { alert("Detail-Controller"); } } } The UI-Router is configured as follows (simplified): var app = angular.module("app", ["ui.router"]) .config(($stateProvider, $locationProvider, $urlRouterProvider) => { $urlRouterProvider.otherwise("/"); $stateProvider.state("store", { url: "/Store", templateUrl: "/Store/Partial?name=Layout" }); $stateProvider.state("store

ui.router, $scope, and controllerAs

柔情痞子 提交于 2019-12-12 23:09:46
问题 I am unable to get the following to work, I keep getting an Unknown provider error. Any ideas? var app = angular.module('app', ['ui.router']); app.config(function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise("/"); $stateProvider .state("home", { url : "/", templateUrl : "resources/static/views/home.html", controller: "HomeCtrl", controllerAs: "homeCtrl" } ); }); app.controller("HomeCtrl", ["$scope", function ($scope) { var _this = this; // do stuff }]); Full Error:

ui-sref link not working on ipad

隐身守侯 提交于 2019-12-12 17:44:56
问题 My (phonegap) application is working fine in my browser (Chrome+Ripple) as well on my android tablet. However the link isn't working anymore when build the app with xCode and run it on the iPad. $rootScope.$on('$stateChangeError', function(){..}); shows an error: config: Object data: "" headers: function (c) {a||(a=vc(b));return c?a[D(c)]||null:a;} status: 404 statusText: "" __proto__: Object I guess 404 means "state not found"? Route: .state('seminar', { url: "/seminar/{id}", views: { 'nav@'

controller only initialized once even if `$stateparams` changed

我与影子孤独终老i 提交于 2019-12-12 17:42:03
问题 I've recently started working with the Ionic Framework (and therefore with Angular.js as well) and I ran into a problem with the Angular UI Router : One of the states I registered is not re-initialized when one of its $stateParams changes. At first I thought it happens because the state is abstract and has children, so it is never activated directly - but even when I changed it to be non-abstract and one of the "deepest" states (i.e. a leaf when seeing the states within a tree structure), the