angular-ui-router

ui-router not producing correct href attribute in angular

巧了我就是萌 提交于 2019-12-08 12:22:52
问题 $stateProvider .state('admin', { abstract: true, url: '/admin', template: '<div ui-view></div>' }) <a ui-sref="admin">admin</a> The url I get is <a href="/admin">admin</a> when it should be /#/admin -- this breaks when I command click on a link to open in a new tab. 回答1: This is a known issue, reported as a bug. Will be fixed in next release. Here is a workaround: Impossible to disable html5Mode with angular 1.3.0-rc.3 #1397 Due to: angular/angular.js@dc3de7f the html5mode-check in urlRouter

unable to invoke uiCanExit - angular ui router 1.0.0 beta

余生长醉 提交于 2019-12-08 12:13:30
问题 I have the following routes file in components/app/app-routes.js : export default function AppRoutes($stateProvider, $urlRouterProvider, $transitionsProvider) { 'ngInject'; // reference: https://ui-router.github.io/guide/ng1/migrate-to-1_0#lazy-resolves const defaultResolvePolicy = { when: 'EAGER' }; const STATES = [{ name: 'logout', url: '/logout?applicationName&desktopName&sn', }, { name: 'base', url: '', abstract: true, template: '<ui-view></ui-view>' }, { name: 'app', parent: 'base',

how to empty reference object in angular js?

风流意气都作罢 提交于 2019-12-08 09:39:31
问题 I am trying to empty my reference object .But it is not deleting or removing my chart . I make two directive and communicate with shared service.But then I delete my reference object .it not deleted my chart ..on click of "delete" button i need to delete my chart .. is it possible ?because I take reference objects here is my code http://plnkr.co/edit/TzUlqoh4sYVjH3ADRTGL?p=preview angular.module('app',['header','chartm','hig']).controller('cntrl',function(){ }).service('sharedService'

Angular ui-router and ocLazyLoad

怎甘沉沦 提交于 2019-12-08 09:37:40
问题 Scenario: I have some angular modules like: angular.module('app', ['app.core', 'app.views']); // not lazy load Each module under app.views uses a RouterUtil to register their own route, like: $stateProvider.state('state name', {/* some configs here */}); This RouterUtil also have a method to access all registered states (used to create a dynamic menu). And I'm using the ocLazyLoad, just to load an external module. When the page is loading, ocLazyLoad will perform a request to other js with

AngularJS ui-router views with custom data

自闭症网瘾萝莉.ら 提交于 2019-12-08 08:08:12
问题 I have an AngularJS app and use the ui-router for routing. One of my pages has two similar sections with the same template and logic (so I hope they can use the same controller). The only difference between them is for example type property. Here is simplified fiddle of the page: http://jsfiddle.net/e_gluhotorenko/XeX59/7/. So Is it possible to provide custom different data to the views's scopes ? Something like custom data in states but for views: views: { 'section1' : { templateUrl:

$state.go won't change route in angular after confirmation

孤街醉人 提交于 2019-12-08 08:05:51
问题 I have this code to confirm navigation away in angular, using angular-ui router: $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { //checks if campaign has been modified without save. //if yes state change needs to be confirmed by modal //otherwise simple navigates away event.preventDefault(); // var _this = this; _this.toState = toState; _this.toParams = toParams; var modalInstance = bootstrapModals.confirm({ title: "Exit without saving?",

Option url path UI-Router

守給你的承諾、 提交于 2019-12-08 08:04:18
问题 In my angular application, I am making heavy use of nested states with UI-Router. I am trying to create a parent state that determines the locale of the application based on a URL that has an optional locale path. For Spanish www.website.com/es/search For English www.website.com/search the '/es' is required for Spanish, but English is implied by the parameter missing and I would prefer to not have the '/en' . I want any child state of this one to inherit that locale value. $stateProvider

Uncaught ReferenceError: $stateProvider is not defined Angular UI Router

让人想犯罪 __ 提交于 2019-12-08 07:54:54
问题 For some reason I'm getting this error Uncaught ReferenceError: $stateProvider is not defined even though angular-ui-router.js is being loaded fine. the error in Dev Tools here is my app.js var app = angular.module('app', ['ui.router']); app.config([$stateProvider, $urlRouterProvider, function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise('/'); $stateProvider .state('main', { url: '/', templateUrl: '/partials/main', controller: 'mainCtrl' }); } ]); 回答1: app.config([

UI-Router default view inside div

丶灬走出姿态 提交于 2019-12-08 07:00:44
问题 Say I have index.html with: <div ui-view="viewA"> // content </div> Is it posible to put content inside div that will serve to me as default route? So without including or anything else, just need to put some markup directly in that div. 回答1: There is a working plunker That is possible, and really pretty easy. So, let's have this inside of index.html <div ui-view=""> this is the content of ui-view, which serves as a template for a default state </div> And this could be the default state and

AngularJS. Retain state after page reload

▼魔方 西西 提交于 2019-12-08 05:49:04
问题 I am using UI Router with html5Mode enabled, states are loaded from JSON. Expected behavior after F5 or when pasting URL is, respectively, having current state reloaded or navigating to the said state, instead the initial application state is loaded. For e.g. root/parent/child gets redirected to root/. By the way, navigating with ui-sref works fine. So, how can the state be retained after page reload? 回答1: In order to retain the state of page after reload app, a url represent the state should