angular-ui-router

Angular ng-submit not firing the desired controller method [duplicate]

血红的双手。 提交于 2019-12-23 16:32:47
问题 This question already has answers here : AngularJS Login form with ng-click not working (2 answers) Closed 4 years ago . In Angular 1.4.7, I'm trying to implement a basic login form in this plunk http://plnkr.co/edit/xQEN1ZNN5ZEw1CSwNw97?p=preview (Please click on the red Log into Dashboard button on the Home route). However for some reason I cannot get the login() method to fire in my loginCtrl controller code. Instead what it's doing is an old-school URL redirect with the user/password

how to change route for each tab in uib-tabset

淺唱寂寞╮ 提交于 2019-12-23 16:30:37
问题 When I choose a tab, I want the url to change. should I create a state for each tab ? This is my code which works fine without changing the state . My app.js var myApp=angular.module('app', ['ui.router','ngAnimate', 'ui.bootstrap']); myApp.config([ '$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) { $stateProvider.state('/', { url: "", views: { "ratios": { templateUrl: "views/requetes.html" }, "reqBase": {templateUrl: "views/common.html" }, "SQLconsole":

ui-router does not run a parent state's resolve promise when using $state.go()

孤者浪人 提交于 2019-12-23 14:35:52
问题 I have an abstract parent state with a resolve promise which returns information about the current user. This information is injected into controllers of all the child states. However when I use $state.go('parent.child') the resolve promise function is not being executed. If I browse to the URL representing that state though, it executes fine. Do I need to specify the resolve object on each child state and omit it from the parent? 回答1: A parent state resolve will only resolve once for a given

Angular JS - UI router page reload won't set the state

荒凉一梦 提交于 2019-12-23 12:18:27
问题 This is my main app (app.js) (function(ng, module) { module.config(['$stateProvider', '$urlRouterProvider', function( $stateProvider, $urlRouterProvider){ $urlRouterProvider.otherwise("app"); $stateProvider.state('login', { url: 'login', templateUrl: '/assets/templates/pages/login.html' }).state('root', { url: '', templateUrl: '/assets/templates/pages/index.html' }); }]); }) (angular, angular.module('myapp', ['ui.router', 'myapp.submodule'])); This is the submodule (submodule.js) (function(ng

Angular $state.go {reload: true} shouldn't reinitialize the abstract father controller

前提是你 提交于 2019-12-23 12:09:51
问题 I'm using ui-route for navigation. I have father state called main , it's an abstract state (the url: /main ) and child states products and users (urls: /main/products and /main/users ). app.config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise("/main/products"); $stateProvider .state("main", { url:"/main", templateUrl: "main.html", abstract: true, controller: "MainCtrl", }) .state("main.products", { templateUrl: "products

update $stateParams in ui-router after $location.search() is called

£可爱£侵袭症+ 提交于 2019-12-23 12:09:11
问题 I have an angular application which is using the ionic-framework, which uses ui-router on the back end. In one of my controllers I call: $location.search('filter','sometext'); I have reloadOnSearch disabled in my routing configuration. I noticed that updating the location does not update the $stateParams . Is there a way to force the $stateParams to update as the location is updated? I looked through the ui-router documentation, but didn't see anything about this scenario, but perhaps I

ui-router. get state name from object/function

徘徊边缘 提交于 2019-12-23 11:53:21
问题 I wonder, is there any way to reference states in view with object or function? Just to decouple views from states definition. E.g. if I change state name I don't have to change it everywhere in my views. 回答1: One solution, described below, could be found here, as a working plunker In this example we will define state for some entity (e.g. employee) like: list view and detail view. Let's use some variable entityName to play the role of the decoupled naming: var entityName = "employee";

Remove DOM-Element with AngularJS

混江龙づ霸主 提交于 2019-12-23 10:23:03
问题 I'm trying to remove a navbar based on the current location path. This is what I have so far: angular.module('myModule') .controller('MainController', function ($location, $document) { if ($location.path().indexOf('resetpass') > -1) { var navbar = angular.element($document.querySelector(".top-navbar")); navbar.remove(); } }); With this approach the console says: angular.js:14110 TypeError: $document.querySelector is not a function at new <anonymous> (main.controller.js:6) at Object.invoke

ui-router not rendering views

試著忘記壹切 提交于 2019-12-23 10:07:06
问题 I recently split out a rails app I had and created the front end as a separate app with yeoman. For some reason my views no longer render, for example my app defines: 'use strict'; var actionTrackApp = angular.module('actionTrackApp', [ 'ui.router', 'ngGrid']); actionTrackApp.config(function($locationProvider) { return $locationProvider.html5Mode(true); }); actionTrackApp.config(function($stateProvider){ $stateProvider .state("packageIndex", { url: "/packages", views: { "main": { controller:

How to preserve ui-router parameters on browser refresh

时光怂恿深爱的人放手 提交于 2019-12-23 09:58:51
问题 am using angular ui-router to manage states of my SPA. I have this route: .state('index.administration.security.roleEdit', { url: '/roleEdit', templateUrl: 'app/administration/security/role/roleEdit.html', controller: 'roleEditCtrl', controllerAs: 'roleEditCtrl', params: { data: null }, resolve: { role: function ($stateParams) { return angular.fromJson($stateParams.data); }, modules: function (securityService) { return securityService.getAllModules(); } } }) Also, I'm passing 'data' parameter