angular-ui-router

ASP.NET MVC with Angular :- page refresh or reload gives 404 error

泪湿孤枕 提交于 2020-01-11 05:54:13
问题 Angular Ver : 5 I am working on a new project with ASP.NET MVC and have integrated angular 5 with it. The project is working fine except the page refresh yields the 404 page not found error. Whenever i hit refresh from the browser or reload the page, it gives the 404 error. I have gone through many tutorials and discussions on this Angular page refresh problem, but no luck so far. I am using the MVC shared view _Layout.cshtml to specify the angular lib references and the base reference as

Consecutive calls to console.log produce inconsistent results

廉价感情. 提交于 2020-01-11 03:10:07
问题 Ok, I'm completely dumbfounded by this. (and I might be overlooking something obvious but...) I have 2 consecutive calls to console.log. There isn't anything else between them console.log($state); console.log($state.current); and here's an image of the produced results Why do the 2 produce different "current" objects? How can this happen? Context: Those calls are made inside an ajax call while resolving a route dependencies. If you need more code or context let me know. Confirmed the same

Creating nested route app in angular using angular-ui-router and switching between modules

☆樱花仙子☆ 提交于 2020-01-10 04:46:24
问题 I want to create angular nested routes in my application using angular-ui-router with multi sub-modules; In " ui-router " we can use multi views in our main app config as $stateProvider , but can't switch between sub-modules when you are in other module. For example when you are in " module1 " you can not state to " module2 ". So, How can I switch between my modules? 回答1: In this application you can route between sub modules easily: Create main application " mainApp.js " angular.module(

How can I pass data with URLs to ui-sref?

穿精又带淫゛_ 提交于 2020-01-10 04:42:05
问题 I ny view I have: <a ui-sref="app.file({path: file.path})">{{ file.path }}</a> file.path is html/hero-sidebar.html My state is defined as: .state('app.file', { url: '/file/*path' views: repositoryView: templateUrl: '/templates/app/_file.html' }) But when I click the link, it goes to http://localhost:9001/app/file/html%252Fhero-sidebar.html What I want is for it to go to http://localhost:9001/app/file/html/hero-sidebar.html Is this possible using ui-router with AngularJS? 回答1: There is already

Suppress reloading of ui-router based view on query parameter change

…衆ロ難τιáo~ 提交于 2020-01-09 17:55:06
问题 Updated question Question in title still stands - is it possible to catch ?parameters and cancel view reload. Original question : I need to add anchor support for my application (anchors to topics). Here's how far I am: angular.module('app.topics', [ 'ui.state', 'ui.router', 'restangular' 'app.topics.controllers' ]) .config(function config($stateProvider) { $stateProvider.state('viewtopic', { url: '/topics/:slug?section', onEnter: function($stateParams) { // Works, as state has been reloaded.

ionic routing issue, shows blank page

佐手、 提交于 2020-01-09 11:46:11
问题 I started building ionic app on top of the sidemenu starter app. The starter app has a base state 'app' which is abstract and all the sidemenu pages are children of the app for example app.search, app.browse, app.playlists etc. I have similar hierarchy. However, I want the start page to be some other page, which means it is at the app level. The states look like this: $stateProvider .state('app', { url: "/app", abstract: true, templateUrl: "templates/menu.html", controller: 'AppCtrl' })

How to decorate current state resolve function in UI-Router? Current function isn't invoked

亡梦爱人 提交于 2020-01-09 10:32:34
问题 I'm trying to DRY in $stateProvider and prevent adding the same auth function in each resolve. I've created decorator that in each state change would add this function to current state, but auth function isn't invoked, How to fix it or how to workaround discussed issue? app.config(function ($stateProvider, $urlRouterProvider, $provide) { $provide.decorator('$state', function($delegate, $rootScope) { $rootScope.$on('$stateChangeStart', function(event, state, params) { if ($delegate.current ===

angularjs ui-router strange behaviour with additional segment in route

∥☆過路亽.° 提交于 2020-01-09 03:53:44
问题 I'm suffering a problem with ui-router when I add a wrong segment to the route. An example... http://xxx.xxxxx.xxx/roles works fine. This is a route defined without parameters. But if I add another segment in the browse http://xxx.xxxxx.xxx/roles/kk the $urlRouteProvider.otherwise('/') does not work and the application is trying to load all web resources (css, html, javascript, etc.) from a route like http://xxx.xxxxx.xxx/roles/app/app.css returning a lot of errors in console. This code is in

Angular/UI-Router - How Can I Update The URL Without Refreshing Everything?

﹥>﹥吖頭↗ 提交于 2020-01-08 16:56:45
问题 I'm new to both Angular and the ui-router. When someone selects a model and my controller performs a standard SHOW method, I simply want to update the URL to include the model's ID without refreshing the page, and continue on with my original view. I'm not sure how to do this... $stateProvider .state('citylist', { url: "/", templateUrl: "views/index.html" }) .state('cityshow', { url: "/city/:id", templateUrl: "views/index.html" }) angular.module('app.system').controller('IndexController', ['

How to send and retrieve parameters using $state.go toParams and $stateParams?

风格不统一 提交于 2020-01-08 12:04:25
问题 I am using AngularJS v1.2.0-rc.2 with ui-router v0.2.0. I want to pass the referrer state to another state so I use the toParams of $state.go like so: $state.go('toState', {referer: $state.current.name}); According to the docs, this should populate the $stateParams on the toState controller, but it is undefined . What am I missing? I've created a plunk to demonstrate: http://plnkr.co/edit/ywEcG1 回答1: If you want to pass non-URL state, then you must not use url when setting up your state . I