angular-routing

Angular 6 - Unable to retrieve static data

穿精又带淫゛_ 提交于 2019-12-10 19:58:17
问题 Problem: static data defined at route is never retrieved with subscription to data object at ActivatedRoute. Everything else seems to work fine, the data object is not null, but I can't get data from it. When I try to debug the data from the data object it outputs "undefined", when I try to bind it to UI nothing shows up, but when I look at ActivatedRoute messages in Chrome it has the data. After many tries I'm pretty sure my syntax should work based on many examples, so has something changed

How to create routing inside a modal window [ ANGULAR 5 ]?

自古美人都是妖i 提交于 2019-12-10 15:57:33
问题 I have a requirement where i need to switch between 2 different views back and forth based on certain condition inside a modal window's body . Those 2 views are : List items (Initial view) Add new items After adding new items i need to switch to the List items view. NOTE: All these views should be displayed inside a modal windows body. So using ANGULAR 5 routing how can i create new routes / sub routes inside this modal component ? 回答1: Create another router-outlet with a name like this

prioritize ngclick over nghref in <a> elements

荒凉一梦 提交于 2019-12-10 14:53:03
问题 tl;dr : How can I force angular to only execute the ngclick directive in an <a> element without emptying/removing the href ? My site has some custom behavior on some elements (modal opens, location bar updates, etc.) but for SEO indexing I also need it to be an <a> element with an href attribute containing a valid link. Such as: <a href="/{{item.url}}" ng-click="doCustomStuff(item)">some link</a> However, angular also executes the href and the routing makes my custom ng-click logic useless.

angular-ui/ui-router with Steroids

假如想象 提交于 2019-12-10 11:15:01
问题 I am trying to get a basic example running that uses Steroids and Angular-UI/UI-routes for an app with nested views. I created a Steroids app using the startup example here, and then I am trying to populate it with the angular-UI/UI-raouter example here (this is their Plunkr). My opening page only shows " State 1 State 2 " literally. So something is off, but I think I have reached the end of my debugging and guessing skills. Here is what I have thus far: I added a 'partials' folder in the app

How to define optional parameter using UI-Router without trailing slash as well?

孤人 提交于 2019-12-10 10:27:51
问题 I was working on migration of my Angularjs code from ng-router to UI-Router. In my ng-router I have optional parameters however I realized that same easy way to support optional parameter is not supported in ui-router. Following is my routes from my existing ng-router module. //Define routes for view using ng-router $routeProvider. when('/my-app/home/:userid?', { templateUrl: '/templates/partials/home/HomeView.html', controller: 'HomeViewController' }) .when('/my-app/:productKey/:userid?', {

Angular using $routeParams in Page title

余生长醉 提交于 2019-12-10 04:52:33
问题 I found this answer in another SO question. But i would like to also use route parameters in some of the page titles. If i have a $routeProvider like this: $routeProvider.when('/demo/:name/:idNumber', {title : ' - :name', templateUrl: 'partials/details.html', controller: 'AppDetails'}); how do I match the :name in the title to the :name in the location? I tried the following .run(['$location', '$rootScope', '$routeParams', function($location, $rootScope, $routeParams) { $rootScope.$on('

Difference between router and router-deprecated in angular2

坚强是说给别人听的谎言 提交于 2019-12-10 02:34:54
问题 I've updated from "beta.17" to "2.0.0-rc.1" and I don't understand when I should use router and when router-deprecated? 回答1: UPDATE TO ANGULAR2 RC There are alot of changes has been made in routing in angular2 after RC some of them points i am going to mention here may help someone :- angular2/router has been changed with @angular/router (also you can use old functionality of routing using import of @angular/router-deprecated but as of now we have to use @angular/router ). @RouteConfig has

AngularJS - get the list of defined routes - $routeProvider

我的梦境 提交于 2019-12-10 02:16:08
问题 I am trying to implement named routes , so I don't have to write the whole path (often changes). I was thinking I could get away with writing a service that would return the list of defined routes and a filter that would transform object to aroute The use example would look like: <a ng-href="{id:1}|route:'detail'">Click here!</a> Provided I have added name:'detail' to my route definition, this would generate the following result : <a href="#/detail/1/">Click here!</a> I think this is quite

How can I conditionally use either [href] or [routerLink] on an anchor?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 01:00:28
问题 I need for the same anchor link to be pointed conditionally locally or to external resource. I tried <a [href]="outside?externalUrl:null" [routerLink]="outside?[]:['/route',id]" >test</a> But it doesn't work. I don't get any errors, but it points to the same local page and ignores the external URL. Any ideas? Another option would be to construct the link, but I can't find any docs how to access routerLink inside a service Edit: I know I can clone the whole link with *ngIf but I don't want to

AngularJS change URL in module.config

五迷三道 提交于 2019-12-09 19:19:30
问题 I use Restangular in my angularjs App & use setErrorInterceptor to handle response error in one place. I want to redirect user to login page if an error occured. I know that the only providers & constants are injectable in configuration phase. var app = angular.module('ourstandApp', ['ngRoute', 'restangular', 'ui.bootstrap', 'ngCookies', 'angularFileUpload']); // Global configuration app.config(function (RestangularProvider, baseRequestConfig, $routeProvider, urlsProvider) { var