angular-routing

Angular : Error: Uncaught (in promise) at webpackAsyncContext (eval at ./src/$$_lazy_route_resource

人盡茶涼 提交于 2019-12-03 17:56:05
问题 I'm upgrading from Angular 4.0.0 to Angular 5.2.6 i'm facing some problem to get lazy module loading working. with angular 4.0.0 , it works fine , but now , with 5.2.6 , i getting such an error when clicking my redirecting button : core.js:1448 ERROR Error: Uncaught (in promise): TypeError: undefined is not a function TypeError: undefined is not a function at Array.map (<anonymous>) at webpackAsyncContext (eval at ./src/$$_lazy_route_resource lazy recursive (main.bundle.js:27), <anonymous>:13

How to prevent view redraw when changing route in AngularJS

旧街凉风 提交于 2019-12-03 16:23:25
I'm making a web app where users can view objects on a map, press a marker and go to a new view with information. From that view they can traverse deeper, into more information. Something like: /map /tree/{treeid} /tree/{treeid}/information/{informationid} I know how to keep the actual model state when traversing between routes/states. The problem is that I don't want to recalculate the entire map (with markers and everything) when I go back in the browser history. In other words, I want to keep the rendered state of /map when traversing further. This can easily be achieved by using search

Angular 5 - Dynamic base reference is causing duplicate loading of bundles|chunks

末鹿安然 提交于 2019-12-03 12:31:40
I am using Angular 5.2 version in the project. I am setting the base reference dynamically in the index.html to satisfy the different URL for different clients. The app main page url looks like this :- http://example.com/client1/app/login http://example.com/client2/app/login http://example.com/client3/app/login client1, client2 etc are virtual directories in the IIS. When i run the app in the browser, i can see from the inspect window that the duplicate chunks are getting loaded and causing the app page to slow down. One thing i observed the web request url of the duplicate chunks. let's say

AngularJS, using routes without refreshes on back button

与世无争的帅哥 提交于 2019-12-03 11:55:16
I'm using angularJS to build a simple single page application using AJAX, but I'm running into a problem when users use the native back button. angular.module('myApp', ['ionic', 'myApp.controllers', myApp.services]) .config(function ($routeProvider, $locationProvider) { $routeProvider.when('/home', { templateUrl: 'templates/feed.html', controller: 'MenuCtrl', reloadOnSearch: false }); $routeProvider.when('/checkin/view/:id', { templateUrl: 'templates/checkin.html', controller: 'MenuCtrl' }); $routeProvider.otherwise({ redirectTo: '/home' }); $locationProvider.html5Mode(true) }) UPDATE: moved

How to make a named routing outlet work with loadChildren?

試著忘記壹切 提交于 2019-12-03 10:50:16
问题 I've created two plunkers concerning an issue with routing's loadChildren and outlet navigation. For some reason, having an empty base path within the loaded child module does not work with outlet navigation. In this example, pressing the 'Contact' link fails. app-routing.module const appRoutes: Routes = [ { path: 'admin', loadChildren: () => AdminModule }, { path: '', redirectTo: '/admin', pathMatch: 'full' } ]; admin-routing.module const adminRoutes: Routes = [ { path: '', component:

Angular 7 routerLink directive warning 'Navigation triggered outside Angular zone'

十年热恋 提交于 2019-12-03 10:21:35
I am struggling with Angular framework to get my application run smoothly, but I can't resolve an issue with routing. I have a top level AppComponent and app-routing.module.ts which manage the navigation via my custom SlideMenuComponent . My simplified html template of AppComponent : <app-slide-menu [buttons]="menuButtons"></app-slide-menu> <router-outlet></router-outlet> My SlideMenuComponent has the following html as its core: <nav><div *ngFor="let button of buttons"> <a routerLink="{{button.routerLink}}" >{{button.name}}</a> </div></nav> A user can navigate to '/courses' through this slide

How to use multiple index pages in angularjs

非 Y 不嫁゛ 提交于 2019-12-03 09:57:21
问题 I want to access the localhost:3000/admin which is in my views .. the index.html and the admin.html are my two different base files one is for users and the other is for admin dashboard respectively in my app.routes.js I have this angular.module('appRoutes', ['ngRoute']) .config(function($routeProvider, $locationProvider) { $routeProvider .when('/', { templateUrl: 'app/views/pages/home.html', controller: 'MainController', controllerAs: 'main' }) .when('/admin', { templateUrl: 'app/views/admin

Assign multiple controller in $stateProvider.state

假如想象 提交于 2019-12-03 05:39:27
Probably this is an easy question for advanced angular users, but I did not find this issue somewhere well explained. So I was restructuring my code, when I realized, I have two controllers in a view, which is not a problem, when controller 'ACtrl' is binded by the $stateProvider and controller 'BCtrl' is binded in the view by ng-controller. But when I try to assign both of them in the $stateProvider like this: $stateProvider.state('a.view', { url: "/anurl", views: { 'menuContent': { templateUrl: "anUrlToMyTemplates", controller: 'ACtrl', 'BCtrl' } } }); or that: $stateProvider.state('a.view',

Angular UI Router - Views in an Inherited State

风格不统一 提交于 2019-12-03 05:06:31
问题 edit: Based on the answer by @actor2019 I want to update my question to better explain the problem: Using Angular UI-Router(v0.0.2), I've setup the app to properly navigate between main "pages"/state, while inheriting the base state. Index.html: <div ui-view></div> base.html: <!-- Header --> <div> <!-- Header markup --> <!-- Search View --> <div ui-view="search"></div> </div> <!-- Page Content view --> <div ui-view></div> The issue is here in the app.js file. When I add the views parameter to

What is the easiest way to get Current Route Path Name in Angular?

大憨熊 提交于 2019-12-03 05:01:16
I was looking for a good way to get the current route's path name. This was the easiest I could find. this.route.snapshot.firstChild.url[0].path Is there a better way? Thanks! Thanks everyone for the answers. Here is what I found that I had to do. router.events.subscribe((event: Event) => { console.log(event); if (event instanceof NavigationEnd ) { this.currentUrl = event.url; } }); Pardeep Jain easiest way to find current path is either you directly use this.router.url or you can check current path on every router change using its events like this this.router.events.subscribe((res) => {