Tagged Questions
1
vote
1answer
39 views
How to correctly load javascript across pages when using the $routeProvider in Angular1
Currently, I make use of Angular's $routeProvider and $locationProvider to browse an SPA.
It's unclear to me how to implement javascript across pages using a controller.
As soon as I switch pages the ...
0
votes
2answers
260 views
Angular routing to redirect on new server with query string
Can someone help me understand how I can redirect an Angular state to a new URL with the query string parameters same as old ones?
Example
If my Angular application is on http://example.com, then ...
0
votes
2answers
2k views
Give URL with ID in Angular UI Router
I have a problem, when I edited data, my url not showing id example : /answer/1 or /answer/2 or /answer/3 etc. Im confused because Im using UI ROUTER
I'm a beginner use UI ROUTER angularjs. Can you ...
0
votes
2answers
2k views
How can I change URL from $scope in AngularJS?
I have made access navigation with $scope and I used them based on click and I did. I can't set URL in variable accommodate. The correct URL is http://www.example.com/base/index or http://www.example....
1
vote
2answers
207 views
Make two layouts share the same $scope
I want to propose two layouts (ie, horizontal and vertical) for my contents. So switching in the selector will lead automatically to the corresponding layout. Here is the JSBin:
<html ng-app="...
0
votes
1answer
51 views
Injecting $location service makes my url with fragment identifier weird
Here is my angular code
var app = angular.module('app', []);
app.controller('mainController', ['$location', '$scope', '$log', function(location, scope, log) {
log.info(location.path());
}]);
And ...
5
votes
4answers
214 views
$scope not working in my nav bar controller?
My Angular app is developed using a boilerplate of this yeoman generator.
Routing and all things working fine but I could not get to working $scope only on navbar-controller.js and footer-controller....
0
votes
1answer
81 views
AngularJS back/forward button update model/scope
I'm having an issue with AngularJS and URLS. When I press the back/forward buttons in the browser I want my models to update accordingly. As you can see from this page:
http://www.networkwestmidlands....
0
votes
1answer
28 views
$location.search() used with external function reset whole $scope. How to avoid it?
Example of problem: Plunker
Its about controller.js file. I am trying to pass cleanSearchParameters output into $location.search function and it does work, but after whole $scope gets reset.
Check ...
0
votes
1answer
38 views
$location.search() - how to use params from scope inside $scope.$watch function?
I need to pass function variable into $scope and reuse it inside $scope.$watch. I don't know why my whole $scope get resetting all the time in first example.
Living example of my problem:
Plunker
...
2
votes
2answers
638 views
$resolve not added to $scope until after controller creation
I'm trying to take advantage of the (new in 1.5.0) feature that adds the resolve map to the scope of the route. However, it seems like the map isn't actually getting added to the scope until after ...
0
votes
2answers
55 views
Display different template on selecting an option in menu
I'm trying to display different templates on selecting the menu options. I'm able to display it, but I want the menu to be displayed along with respective template selected in menu list (i.e., I want ...
0
votes
1answer
47 views
UI routing not working, angular JS
I'm trying to display main.html template via UI routing, but its not working for some reason. Can someone please point out the mistake in my code. Thank you.
appModule
"use strict";
angular.module("...
1
vote
1answer
138 views
Data not binded after browser history back
I do have a webpage based on jHipster template and issue with browser back button.
Let's say that I do have two pages
Articles list (/articles/{id},{name}, category id, category name)
Article ...
0
votes
1answer
229 views
Angular ng-view is not replacing the view
I have below code as
<!DOCTYPE html>
<html ng-app="mainApp">
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="https:...
0
votes
1answer
123 views
$scope not updating after passing to new view with $location.path
I have a simple CRUD I put together with Angularjs. From a product list display I pass the user to a new view template for the "Create New" form.
The form processes fine and updates the database. I ...
2
votes
1answer
2k views
AngularJS $scope form attribute is undefined after ng-submit
I'm starting with Angular and I'm still very confused with syntax and the many different ways I can code to get the same result.
My latest problem is that when I submit a form, I can't get its ...
1
vote
2answers
1k views
Enabling a Submit button onclick of another button in a single page app in AngularJS
I have an AngularJS app where I am using UI-Router. There I want to disable a submit button in the beginning and enable it after a user clicks a particular another button. (Try using ng-disabled).
1
vote
1answer
536 views
Why Error:input is undefined AngularJS
I am trying make an ajax request to php from angular js. But I am not getting the data I have sent by php file.
I'm getting this error:
Error:input is undefined
My source:
File view.html:
<...
3
votes
3answers
595 views
Losing form input data when reinvoking a controller
I have a simple multi-view Angular application that implements a wizard, so each time a user clicks "Next" button, the app navigates to the next view, and same for "Back" button. I have a $...
5
votes
1answer
4k views
Angular $routeProvider and Controller As Syntax
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.
...
0
votes
2answers
478 views
Unable to broadcast event from parent controller in angularjs
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-...
1
vote
1answer
48 views
Change view after a post in AngualJs
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:
...
3
votes
3answers
8k views
Angular View Not Updating with New Data
I'm a bit of an Angular newbie so sorry if this is obvious.
I have a backend which returns an array of objects. After I retrieve them, I move to the next page and i need to display a checkbox for ...
0
votes
2answers
952 views
AngularJS controllers in separate files not identifying the scope
I am learning AngularJS and so far I have the beginnings of a skeleton app, with a main index page and two templates: a login page and a home page which have very simple controllers. I have not ...
-2
votes
1answer
197 views
resolve in angularjs not working
I would like to load my data before the route changes and using
$routeChangeSuccess
or
$routeChangeStart
will not help and would like to do it using resolve in angular routing. So when ever a ...
2
votes
1answer
70 views
dynamic scope values angularjs
I have multiple routes which serves different pages like so:
$routeProvider.
when('/routeone', {
templateUrl: '/routes/one',
resolve: {}
})
.when('/routetwo', {
...
25
votes
3answers
28k views
scope and controller instantiation with ui router
I am confused about when controllers get instantiated. Also, how do controllers gets instantiated when nesting states. I might be confused how scope gets attached to view and controller, that is, if ...
0
votes
1answer
124 views
Passing $scope data to $stateProvider.state resolve
I have a parent state app.teams.show which stores "team" in $scope.data.team. Within a controller I have access to $scope.data.team and therefore $scope.data.team.organization_id.
How can I access $...
0
votes
0answers
58 views
angularjs static searchbox in all pages
I have a searchbox , list of items , when I click on each item it will take me to the item info tempate.
right now in my below code the searchbox is inside the items.html and it only appears in there ...
0
votes
1answer
3k views
In angular js, how do I show angular-loading bar with ui-router and ocLazyLoad
Problem : I am not able to load the angular-loading-bar using lazy load and ui.route.
Am I missing something ?
This is how my config.lazlyload.js file looks like :
// lazyload config
...
1
vote
3answers
900 views
Trying to persist data across controllers using Angular rootScope, but always getting undefined
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="$...
1
vote
0answers
65 views
Why am I getting error on my browser after my view changed to other view (angular)?
I have problem with my ng-view. When I successful change to other view, Am getting error from browser**(node-webkit):
There is error:
Error {stack: (...), message: "Not running"}message: "Not ...
0
votes
1answer
258 views
Route resolving + multiple controller combo?
I'm trying to combine 2 concepts and I'm having trouble making them work together.
Concept 1: Route resolving. This is easy to explain, I just want to resolve certain models like this:
$...
1
vote
1answer
503 views
accessing scope data outside ng-view in AngularJs
I have a SPA and the body of the index.html is something like below:
<body>
<div id="wrapper">
<div data-ng-include src="'partials/header.html'"></div>
<div ...
4
votes
1answer
938 views
AngularJS - handle routes before app startup
Is it ok to use a Service within $stateProvider, for this purpose?
I have been through a lot of posts on stack regarding routing but most are confusing for beginners as everyone uses a different ...
2
votes
1answer
4k views
Angular service reset when changing page through Angular routes
I have multi page signUp form , I need to persist data until last step , so that user can jump to any step back and edit.
I am using service "User" as singleton object for all six steps.
userService....
0
votes
2answers
3k views
How to stop execution of Controller with $routeChangeStart in angularjs
I am setting session on login and after that I am preventing LoginCtrl to be called as it is resetting session.
I have a setup of routes where if any undefined route is called it takes to /login But ...
1
vote
1answer
352 views
Angular js api url call not working
app.controller('Ctrl', function ($scope, $http) {
$http({method: 'GET', url: "/api/v1/coupons-dunia/coupons-by-website?websiteId=1"}).success(function(data) {
$scope.onlinedata = ...
0
votes
1answer
46 views
Show form using custom directive - AngularJS
I have a button with ng-click function. When I click the button, it should show the form which is coded in a templateUrl using a custom directive.
Which function should I use to get the screen ...
0
votes
2answers
757 views
calling ng-view controller method from outside controller?
HTML:
<html ng-app="san">
<head>
</head>
<body ng-controller="sanctrl">
<div>
AngularJS</div>
<div ng-view="">
</div>
<button type="button" ng-...
0
votes
0answers
83 views
How to stop changing routes in angular js
I am new to angular. I am trying to stop navigation to the index page if the user is already logged in. That means I use a cookie by applying the following code.
app.run(['$rootScope', 'authService', ...
0
votes
1answer
211 views
Can not prevent accessing to a specific route using $routeChangeStart
In angular js I have a routing function that should manage access to routes for admin and non admin users so i used to $routeChangeStart achieve that according to my logic if a user is logged in he ...
0
votes
2answers
337 views
Multiple AngularJS apps on page
I'm a noob in AngularJS, therefore sorry for stupid questions.
What I'd like to do is to use the same application in two (or more) places on a page. For that I've created two HTML elements and have ...
1
vote
1answer
567 views
AngularJS routing with id parameter ends in white page
var app = angular.module('application', [ 'ngRoute', 'ui.bootstrap' ]);
// configure our routes
app.config(function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$...
6
votes
4answers
4k views
AngularJS AppCtrl wait for HTTP event to success
I'm all new to AngularJS and need some help, I have a "AppCtrl" and from there I have a HTTP webservice call - and need the webservice call response accessible in my other controllers.
angular.module(...
1
vote
1answer
372 views
Scope inheritance fails with multiple-named views?
It breaks when moving from (Plnkr):
.state('home', {url: '/home', template: '<pre>{{parentProp}}</pre>',
controller: function ($scope) {$scope.parentProp = ['home'];}})
...
1
vote
1answer
541 views
Dynamically switch ng-include between controllers
I have the following bit of code for my navigation that I want to update dynamically between pages.
<nav ng-include="menuPath"></nav>
Here is my app and routing set up
var rxApp = ...
0
votes
1answer
60 views
AngularJS adding content to the routing for a back button
.when('/football', {
templateUrl : 'assets/pages/football/home.html',
controller : 'footballController'
})
.when('/football/teams', {
templateUrl : 'assets/pages/football/teams.html',
...
0
votes
2answers
415 views
AngularJS load in controllers that are in separate files
app.config(function($routeProvider) {
$routeProvider
// route for the home page
.when('/demo', {
templateUrl : 'assets/pages/home.html'
})
...