FAQ Database Discussion Community


Little bit complex routes in angular

javascript,angularjs,angularjs-routing
I would like to achieve a routing as you can see the example below, controllers are missing at the moment. I like it because the routes reflects how the partials are organized and how the system modules are exists. After a little search it seems angular route can't do this...

Ionic - Reload and display new data in ng-repeat when clicking back button

angularjs,angularjs-ng-repeat,ionic-framework,angularjs-routing,ionic
Background I have an ng-repeat list that goes to a details page (which has a back button). The $scope.items variable is loaded from a get request that occurs when the page is first loaded, with my refreshItems() function. The Problem When you click the back button on the details page,...

SImple AngularJS Route example didnt work

angularjs,routes,angularjs-routing
I wrote a simple route example in angularjs. I dont know why it does not work? not receive any error messages. After entering the page I get only 'A-Mail' message from h1 header. index.html <!DOCTYPE html> <html ng-app="AMail"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script src="controller.js"></script> <title>A-Mail</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">...

How to keep entered data of page1 after navigating back from page2 in AngularJS

html,angularjs,angularjs-service,angularjs-routing,angularjs-controller
I have three pages with routing. If I entered some input and getting some result on first page, next I navigated to second page and finally I came back from second page to first page. Then I want to see the data what I entered previously and result also. Here...

Ionic not reflecting Changes to parent scope

angularjs,angular-ui-router,ionic-framework,angularjs-routing
I have done this many time in pure angular.js with ng-router but dont know whats wrong with it here in ionic using ui-router I want to have some $scope properties/objects on parent scope that i can read and modify from child scopes and they can reflect every where (without factory),...

Relative URL for RouteProvider in AngularJS

angularjs,relative-path,angularjs-routing
I have a website that will likely be placed within a directory in IIS. When I am running the application on my computer through IISExpress, the routes are relative to the base URL, so I can just define my routes as follows: $routeProvider.when("/home", { controller: "homeController", templateUrl: "/app/layout/myView.html" }); This...

AngularJS routeProvider with lazy loading to use values from WebAPI

angularjs,angularjs-routing
I have a routeProvider that lazy loads various modules. I based my implementation on these two articles: http://codereview.stackexchange.com/questions/42581/dynamic-routing-with-lazy-load-controllers http://ify.io/lazy-loading-in-angularjs/ It looks like this and works just fine: myApp.config(function ($routeProvider) { $routeProvider. when('/', { templateUrl: 'templates/startpage.html', controller: 'startPageController', }). otherwise({ resolve: { deps: function ($q, $rootScope, $location) { var deferred =...

AngularJS - Is it Possible to load two different html with two different routers(one for each .html) in one single application?

angularjs,single-page-application,angularjs-routing
I'm having two HTML files -> index.html and start.html So far I was developing an app(a small application) in a single dimensional thought where index.html serves as the main page and app-route serves as the main router for the application. Now we're creating a bigger application like a .com site...

AngularJs View not showing

javascript,angularjs,angularjs-directive,angularjs-routing,ng-view
Hi I am a new comer to angular js. when I load the page it shows two errors 1 - Error: [$injector:unpr] 2 - Error: [$injector:cdep] HTML index.html <body ng-app="MyApp"> <nav> <!-- navbar items displaying here --> </nav> <div ng-view></div> </body> <script src="libs/js/angular.js"></script> <script src="libs/js/angular-route.min.js"></script> <!--angular controller file--> <script src="libs/apps.js"></script>...

Angular route not working when used with Google App Engine and Flask

python,angularjs,google-app-engine,flask,angularjs-routing
What I'm trying to do: I am trying to build a RESTful Flask application on Google App Engine with Angular handling the routing and view logic while Flask handles back end logic and resources. The Problem: When I start the development server for GAE, the first page loads perfectly. The...

How to do load page in Angular JS?

javascript,angularjs,routing,angularjs-routing,angularjs-controller
How to load content on page by clicking on menu links? For example, there is menu: <a href="#">Personal</a> <a href="#">Contacts</a> Question is in how change template HTML in page for each link?...

Ionic Navigation Issue

angularjs,angularjs-routing,ionic
I am trying to develop the navigation i ionic as follows AppCtrl to Login or Menu Then from Menu to Products or Orders or back to Login My app.html like this <ion-nav-view name="appContent"> </ion-nav-view> My menu.html like this <ion-view> <ion-side-menus enable-menu-with-back-views="false"> <ion-side-menu-content> <ion-nav-bar class="bar-stable"> <ion-nav-back-button> </ion-nav-back-button> <ion-nav-buttons side="left"> <button class="button...

Getting error with AngularJS 1.4 NewRouter and Component Names

angularjs,angularjs-routing
Trying to work with Angular 1.4's new router and ng-link and coming across a naming issue that I don't understand. I have a component that I'd like to name 'statOrders'. I've named the folder, .html, and .js files that same way - everything controllers etc. I tried to be very...

How to build custom URL by adding ?¶ms in Angular?

javascript,angularjs,url,angularjs-routing
I'm trying to build a custom URL and update the URL as the user selects items in my dashboard. For example, after clicking a few items the URL could/should look like: #/dashboard?&portfolio=GOOG&ticker1=GOOG Currently the URL only ends in /dashboard (console.log($location.path());) How would I update the $location.path() to add params like...

Best way to get all URL parameters in angularjs

angularjs,angularjs-routing
I got this URL into my system: http://localhost/myapp/#/campaign/confirm/edit/:id What are the best ways to get campaign, confirm and editinside my controller? ...

How to include and use ui-router in my app without injector errors?

javascript,angularjs,angular-ui-router,angularjs-routing,angularjs-injector
UPDATE I've reverted back to a state before including any ui-router I was getting that terrible $injector error that I could not solve, I've since reverted back and need to know how to simply include ui-router and add in a Config function that will simply route the user to /login...

Open page url in modal on a page (Facebook Photo URLs)

javascript,jquery,angularjs,routing,angularjs-routing
P.S. I am using html5Mode to remove '#' in routing in below scenario Removing the hashtag from AngularJS urls (# symbol) Consider I have two main pages.One is photos where thumbnails are provided and whose url is /someSlug/photos. Other is the url of a single photo '/someSlug/photos/somePhotoId' which shows a...

Change view after a post in AngualJs

jquery,angularjs,angularjs-scope,angularjs-routing,ng-switch
I am doing a SPA. I am using ngResources and I have a really simple form. User can compile it and after he submit the form should appear a new form with only a message that says something like this: "Thank you to use our form ..." I would like...

Unable to boradcast event from parent controller in angularjs

angularjs,angularjs-scope,angularjs-routing,angularjs-controller
I have a two controller having parent-child relationship: This is the route for parent controller: angular.module('app') .config(function ($stateProvider) { $stateProvider .state('data-show', { url: '/data', templateUrl: 'app/data.html', controller: 'DataCtrl' }); }); This is the HTML for parent controller: <div class="block-header"> ... ... <div ng-include="'components/child_page.html'"></div> </div> Code for parent controller: angular.module('app') .controller('DataCtrl',...

Angular $routeProvider and Controller As Syntax

angularjs,routing,angularjs-scope,angularjs-routing,ngroute
Can anyone tell me if it is valid to use $routeProvider with Controller as syntax? I am having issues accessing <h1>{{kickController.foo}}</h1> from the controller where this.foo resides. angular.module('ucp.kick', ['ngRoute']).config(function($routeProvider, APP_BASE_URL) { return $routeProvider.when(APP_BASE_URL + 'kicks', { reloadOnSearch: false, navitem: true, name: 'Kicks', templateUrl: 'kick/partials/kick.html', controller: 'kick as KickController' }); });...

Angular Links in view not working

angularjs,angularjs-routing
I am just beginning to experiment with AngularJS and have come across a problem. My main page renders a <ng-view> element and I have set up the following routes: (function () { var routes = function ($routeProvider) { $routeProvider. when('/', { templateUrl: 'Home/Overview', controller: 'OverviewPageController' }) .when('/Issue/:id', { templateUrl: 'Home/Issue'...

Wait for loading of factory before resolve

javascript,angularjs,angularjs-routing
I have code like this: meow.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $routeProvider .when('/page', { templateUrl: 'application/partials/page.html', controller: 'index', resolve: {'page': ['$resolve', function($resolve) {return $resolve.page();}]} }) .when('/page2', { templateUrl: 'application/partials/page2.html', controller: 'index', resolve: {'page2': ['$resolve', function($resolve) {return $resolve.page2();}]} }) ... .otherwise({ redirectTo: '/error' }); }]); meow.factory('$resolve',...

AngularJS routing, pass id with ui-sref while displaying a slug and not the id in the url

javascript,angularjs,angularjs-routing,angular-routing
I'll outline what I've set up and what I'd like to work: I have a list of items in my template like this: <ul> <li ng-repeat="user in users"> <a ui-sref="user({slug: user.slug, id: user.id})"> {{user.name}} </a> </li> </ul> I have a state provider looking like this: .state('user', { url: '/:slug', controller:...

AngularJS routing noob

javascript,angularjs,routing,angularjs-routing
I am trying to build my first AngularJS routing code but I can't seem to get it to work and error console isn't of much help. My HTML page: <body ng-app="myApp"> <div ng-controller="AppController"> <div class="nav"> <ul> <li><a href="#/template1">Template 1</a></li> <li><a href="#/template2">Template 2</a></li> <li><a href="#/template3">Template 3</a></li> <li><a href="#/somepage">SomePage</a></li> <li><a...

Angularjs don't load controller if press back button

javascript,angularjs,angularjs-routing
I am new to AngularJS. I have 2 views, first one is for customer and other for city. The customer view has some basic fields to add information about customer, including button to add new city. If I press the "add new city" button, then the view for adding new...

Putting additional data to $routeProvider templateUrl request

javascript,angularjs,xmlhttprequest,angularjs-routing,ng-view
I want add to add some headers to the requests for fetching templates so I can reject non-angularjs requests and respond with an error. However it seems that it's only possible using $http and it seems like terrible waste to reimplement a mechanism similar to the one templateUrl provides. Here's...

Nothing happens when Angular Href is clicked

angularjs,asp.net-web-api2,angularjs-routing,asp.net-web-api-routing
I am using Angular Routing with a webapi 2 controller. Although the default path loads with the correct data, when I click on an item in a list containing a link to a details page, no data is loaded. The browser shows what I believe to be the correct url...

Reset/Unload Controller after ChangeState (logout called) . AngularJS

angularjs,authentication,caching,ionic-framework,angularjs-routing
I am Creating an app where the user can login from FaceBook or Twitter. After login, the user is directed to some HomePage. And here, controller loads and my initial function is called which loads data specific to that user. When user clicks on Log Out. The tokens are cleared...

Delaying template rendering for authentication check in Angular

angularjs,angularjs-routing,ngroute
Angular can cause a big security issue if you have static URL's that lead to content in conjunction with an authentication scheme. If an unregistered user visits the page, the content will flash on screen for a moment before redirecting to a safe location. I found this issue, searched extensively,...

Trying to persist data across controllers using Angular rootScope, but always getting undefined

javascript,angularjs,angularjs-scope,angularjs-service,angularjs-routing
I have an administrator login page. When a user successfully logs in as an admin, I want to display at the top of all pages the user visits: <!-- nav bar --> <div> <span ng-show="$root.isAdmin">(ADMIN)</span> </div> I tried using $rootScope to accomplish this, but I keep getting undefined: // controller...

Angular - $state.go not redirecting as expected when user is not logged in

angularjs,angular-ui-router,angularjs-routing,angularjs-ui-router
I'm trying to redirect the user to the login page if the user is not logged in. The only use case that I can't get to work is if the user points the browser to a URL that requires authentication. If the user goes directly to http://.../index.html#/dashboard (requires authentication), the...

playframwork angularjs router

playframework,angularjs-routing
I have an application with AngularJS on top of Play frameework. Want to use Play framework for services only. How do I make my angularjs routing work? My applicaton is always looking into in Play routes and never looks into Angularjs routes and so gives an error that route is...

How can I access non-route url parameters in an angular app?

javascript,angularjs,kendo-ui,angularjs-routing
I am adding an angular app to part of an existing page that uses a lot of kendo MVVM controls in an ASP.NET MVC app. Lucky me. I want to access a parameter from the URL route that is before the angular route. So for a module with: angular .module('myModule',...

Angular adding a body class depending on state

javascript,angularjs,routing,angular-ui-router,angularjs-routing
I have something like this working <body ng-app="ELT" ng-class="{'mapBody': $state.includes('map')}" ng-controller="mainCtrl"> So obviously what I am trying to do is add a class "mapBody" when the state is map and my controller a such .controller('mainCtrl', ['$scope','$state',function ($scope,$state) { 'use strict'; $scope.$state = $state; }]) Is there a better way to...

Need to stop ongoing operation when controller becomes background (or invalid)

angularjs,controller,routing,angularjs-routing,angularjs-controller
I'm writing my first AngularJS application. The landing page has two links #/view1 and #/view2. Every link will call individual controller to render <div ng-view></div> individually. The view1Ctrl will fetch data from server periodically. I can see ajax call in console every X seconds. Now I click #/view2, the app...

Module 'ngRoute' is not available

javascript,angularjs,dependency-injection,angularjs-routing
I have linked the script in my index.html, and referenced it in app.js, but I keep getting the error that ngRoute is not available. Any help would be greatly appreciated! app.js angular.module('gameMaster', ['ngRoute', 'castServices']); .config angular.module('gameMaster') .config(function($routeProvider, $locationProvider){ $routeProvider //welcome page .when('/welcome', { templateUrl: '../../../../pages/welcome.html', controller: 'gameController' }) //gameplay page...

angular routing with ng-include

angularjs,routing,angularjs-routing,angular-promise,angularjs-http
It's a little complex to describe my problem.Now I have two pages to be routed. One is project.jsp,the other is ticket.jsp.The latter can be included in the former using ng-include. In index.jsp,I use ng-view. index.jsp <div ng-view></div> In app.js,I do the routing config and create controllers. $routeProvider.when('/tickets', { templateUrl: 'ticket.jsp',...

Display alert message after page reload

javascript,angularjs,angularjs-routing
I have to call $route.reload(); in controller 2 addData API call so that I can get the added data in my UI. But then the text 'Data added successfully' goes away due to page refresh. controller 1: $rootScope.$on('reloaded', function(event, data) { $scope.$parent.alerts.length=0; $scope.$parent.alerts.push({type: 'success',msg: 'Data added successfully'}); }); controller 2:...

Load a HTML file with NG-Grid in a div using AngularJs

angularjs,angularjs-routing
I have a HTML file where on click of a hyperlink i need to load another HTML file in a DIV inside the first HTML file. Can i achieve this in AngularJS? If so how? Also there is ng-Grid in the HTML. here is the code am trying:

AngularJS routing not working after site hosted into IIS

asp.net-mvc,angularjs,iis-7,single-page-application,angularjs-routing
We are creating SPA technique using AngularJS in ASP.NET MVC framework,AngularJS routing between pages are working fine when it's run from VS2013,but after hosting the application in to IIS7.5 routing not working, Routing Script: var appRoot = angular.module('main', ['ngRoute', 'ngGrid', 'ngResource']); //Define the main module appRoot .config(['$routeProvider', function ($routeProvider) {...

AngularJS + Routing + Resolve

javascript,angularjs,angular-ui-router,angularjs-routing
I'm getting this error: Error: Error: [$injector:unpr] http://errors.angularjs.org/1.3.7/$injector/unpr?p0=HttpResponseProvider%20%3C-%20HttpResponse%20%3C-%20DealerLeads Injector Unknown provider Here's my router (ui.router): $stateProvider .state('main', { url: "/main", templateUrl: "views/main.html", data: { pageTitle: 'Main Page' } }) .state('leads', { url: "/leads", templateUrl: "views/leads.html", data: { pageTitle: 'Dealer Leads' }, controller: 'DealerLeads', resolve: DealerLeads.resolve }) Here's my Controller: function...

AngularJS How would one run two contollers from one website, and have one of them change.

javascript,angularjs,angularjs-routing
The problem I'm trying to right an AngularJS web page, and I have variables stored in a controller. This controller is bound to the first tab. I want to be able to access the variables belonging to this controller (and keep a loop running), from a second tab (with it's...

Navigation works in browser but not in Ionic View iphone app

angularjs,ionic-framework,angularjs-routing,ionic,ui-sref
I have a tabbed application that started out as ionic start myApp tabs. I've been editing it and I added a page called count.html which shared the DashCtrl controller. I link to it in the Dash Tab and it works fine when I'm testing in Chrome on my computer, but...

Getting Unknown provider error for resolved value

javascript,angularjs,angularjs-routing
I have this simple Router: .when('/login/:uuid', { templateUrl: 'views/login.html', controller: 'RoomLoginCtrl', resolve: { roomName: function($route, ServerService) { var uuid = $route.current.params.uuid; return ServerService.getRoomName(uuid); //returns promise } } }) .... And here is the controller: (function(angular) { angular.module('app') .controller('RoomLoginCtrl', RoomLoginCtrl); function RoomLoginCtrl($location, TransferService, roomName) { var vm = this; vm.$location =...

In Angular, how to find the route that “called” the controller from inside the controller?

angularjs,model-view-controller,controller,angularjs-routing
I know that it's possible for two or more routes to share the same controller. However, at the controller, I would like to know which route "called" it. Why? Which route would determine whether I would load a list of records, load one record by its id, or not load...

Routing issue with Laravel 4 and AngularJS in html5Mode

angularjs,laravel-4,angularjs-routing
I am creating a RESTful application with Laravel 4 as backend and AngularJS as frontend. I want to use routing from Angular. routes.php in laravel are set up like this (with one group /api, but it is not necessary) Route::any('{all}', function ($uri) { return View::make('index'); })->where('all', '.*'); My routes in...

Prevent $routeParams from Bleeding Through Codebase

angularjs,angularjs-routing
I am using the Angular $routeProvider service to wire-up my single-page HTML5 applciation. I am using the following routing configuration: app.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/show-order/:orderId', { templateUrl: 'templates/order.html', controller: 'ShowOrdersController' }); }]); Within the ShowOrdersController I need access to the RESTful URL parameter described above as :orderId. It is suggested...

On view call other controllers http request getting triggered automatically

angularjs,angularjs-routing,angularjs-controller
I have a file "controller.js" Which has homeController and sectionController defined. in route.js when('/home', { templateUrl: 'view/main/home.html', controller: 'homeController', access: { requiredLogin: false } }). when('/section/:menu', { templateUrl: 'view/main/section.html', controller: 'sectionController', access: { requiredLogin: false } }) but when call to /section/ is made. I could still see $http request...

Controller being called twice in Ionic (AngularJS)

javascript,angularjs,ionic-framework,angularjs-routing,angularjs-controller
In my angular project the user accepts a EULA then get automatically redirected to their dashboard, however, on this redirect the DashboardController seems to be being called twice, the DashboardController is being called on the route itself, I have checked to see if I have accidently called it again in...

AngularJS $stateProvider loads parent but not child template

javascript,angularjs,angularjs-routing
I just started migrating to AngularJS and I'm already having problems with the $stateProvider from the angular-ui/ui-router framework. This is what I have so far: angular .module('testApp', ['ui.router']) .config(function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise("/index/home"); $stateProvider .state('index', { abstract: true, url: "/index", template: "parent" }) .state('index.home', { url: "/home", template: "child" }) })...

What is the difference between these 2 ways to config the $routeProvider? [duplicate]

angularjs,angularjs-routing
This question already has an answer here: Angularjs minify best practice 5 answers I'm learning Angular and I've seen some examples where the $routeProvider is configured like this: app.config(function ($routeProvider) { $routeProvider. when("/drivers", { templateUrl: "partials/drivers.html", controller: "driversController" }). when("/drivers/:id", { templateUrl: "partials/driver.html", controller: "driverController" }). otherwise({ redirectTo: "/drivers"...

ngRoute in angularjs/multiple views

angularjs-routing,ngroute
I am following a tutorial for learning angular. I am using ngRoute to marry 2 sets of views/controllers. customers.html and cutomersController and orders.html and ordersController. When index.html loads it does show customers.html as desired. But when I click on 'View Orders' link, it does not show the order details. The...

how to get ui-router stateHelper working

angularjs,angular-ui-router,angularjs-routing
I'm trying to create an abstract root state and resolve all data in it, before sub-states are activated - by using ui-router for asynchronous data loading (from a server) prior to activating any routes/states etc For this I'm attempting to use ui-router.stateHelper - as suggested in this answer. I had...