Adding routing for page navigation in angular tree

Issue I need help in adding route to angular tree. HTML Code: <mat-tree [dataSource]=”dataSource” class=”tree-container” [treeControl]=”treeControl”> <mat-tree-node class=”btnLinks” *matTreeNodeDef=”let node” matTreeNodePadding> <button mat-icon-button disabled></button> {{node.name}} </mat-tree-node> <mat-tree-node class=”btnLinks” *matTreeNodeDef=”let node;when: hasChild” matTreeNodePadding> <button mat-icon-button matTreeNodeToggle [attr.aria-label]=”‘toggle ‘ + node.name”> <mat-icon

Continue reading

Angular – Testing Routerguard

Issue I’m currently struggling on unit testing my canActivate() method from my Routerguard Service. The Service looks as follows: import {Injectable} from ‘@angular/core’; import {ActivatedRouteSnapshot, CanActivate, Router} from ‘@angular/router’; import {AuthService} from ‘../../auth/auth.service’; import {Observable, of} from ‘rxjs’; import {NotificationService}

Continue reading

RouterTestingModule not providing provider for Location

Issue I am unit-testing a Component which uses two other components. The other components are created when button is clicked .html <div id=”homepage-top-div” class=”homepage-component-css-grid-container”> … <button id=”get-question-list-button” [routerLink]=”questionListRouterLink” class=”btn content-div__button–blue css-grid-item-button-div btn-sm”>See Questions</button> </div> <div id=”practice-component-top-div” class=”css-grid-container-div common-styles-div–white”> <!– 4

Continue reading

angular-rails-templates: templates are not found

Issue I have a rails application, using angularjs for the client side development. I try to load a template located in `app/assets/javascripts/templates/’: myApp.config([‘$routeProvider’, function($routeProvider) { $routeProvider. when(‘/’, { templateUrl: ‘/index.html’, controller: ‘MainController’ }). otherwise({ redirectTo: ‘/’ }); }]); but I

Continue reading

Dynamic nested routing in angularJs

Issue Trying to implement the following route system with angular stateProvider: some_domain.com/abc/pqr/xyz Issue is the number of levels after “some_domain.com” can vary. It can be like some_domain.com/abc/pqr/xyz some_domain.com/abc/pqr some_domain.com/abc some_domain.com/abc/pqr/xyz/1234 tried the many approaches for this in the state definition:

Continue reading

Collection of(multiple) route params

Issue This route config URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby Route: /Chapter/:chapterId/Section/:sectionId would result in: {chapterId:’1′, sectionId:’2′, search:’moby’} Is it possible however to have a collection of objects trough $routeParams like: [ {chapterId:’1′, sectionId:’2′, search:’moby’}, {chapterId:’1′, sectionId:’5′, search:’mobydick’} ] and what would be the

Continue reading

Passing variable name in angular route

Issue Currently I am able to add routing mechanism in AngularJs with the following code : App.config(function($routeProvider, $locationProvider) { $routeProvider .when(‘/’, { templateUrl : ‘/templates/home.html’, controller : ‘landing’ }) .when(‘/login’, { templateUrl : ‘/templates/login.html’, controller : ‘login’ }); }); What

Continue reading

Routing issue in Angular (happening a "!" in URL)

Issue I’m using Angular ngRoute. When I’m trying to route to another page, it is not redirecting in URL. It shows as http://localhost:58317/#!#%2Fstudents myApp.js var app = angular.module(‘MyApp’, [‘googlechart’, ‘ngRoute’]) app.controller(‘HomeCtrl’, function ($scope) { $scope.msg = “Hello Angular…..”; }) app.config(function

Continue reading

Angular routing, and localization

Issue I have an angular application, that I’ve localized in multiple languages (let’s say english, and french). I would like to serve different locale version of the app depending on the url: myapp.io/en/account myapp.io/en/settings myapp.io/fr/account … I tried to follow

Continue reading

Cannot find module error in angular routing

Issue My Angular project folder structure is +– app.module.ts +– app-routing.ts +– app.component.ts +– product/ | +– product.module.ts | +– product-routing.ts | +– product-detail/ | | +–product-detail.component.ts | | +–product-detail.component.html In my app-routing.ts {path:’products’,loadChildren:’app/product/product.module#ProductModule’} In my product-routing.ts { path: ‘detail’,

Continue reading

Angular forward slash in wildcard route

Issue I have a URL like the following and I need to implement route handlers for it: /shop/et–zubehoer-c16/zubehoer-c48/top-cases–taschen-c63/top-case-32l-rosso-passione-p64 That follows the logic: /shop/{path}/{productname}-p{product} So, path is a variable category structure containing even forward slashes, in this example et–zubehoer-c16/zubehoer-c48/top-cases–taschen-c63. productname would

Continue reading