Tagged Questions
1
vote
1answer
22 views
does angularjs $watch every property on a $scope or only those referenced in template?
Since all watches are evaluated on every $digest, keeping their number low is a good perf practice. To rephrase the question title, is there a perf penalty for declaring either a variable or method on ...
0
votes
1answer
17 views
AngularJS Access object
When in AngularJS
I write the following Edit {{locations}} Home
It shows as Edit [{"title":"Hello","gps":"1"}] Home
When I try Edit {{locations.title}} Home
It shows as Edit Home
What would I ...
0
votes
3answers
36 views
AngularJS object keeps over-writing and wont push
I have the following AngularJS below which opens up a dialog and I type into 2 input fields and press ok() which will write the values of the inputs to my $scope.
This works but when I open the modal ...
0
votes
2answers
29 views
AngularJS push of undefined
Cannot call method 'push' of undefined
I receive that error when my AngularJS runs the following:
$scope.ok = function () {
$modalInstance.close();
$scope.key.push({ title: '', gps:'', ...
0
votes
2answers
32 views
From an AngularJS controller, how do I resolve another controller function defined in the module?
Self explanatory fiddle: http://jsfiddle.net/5FG2n/6/
I need to dynamically choose the controller to use at runtime based on its name as a string. The string will be read from a config object.
In ...
0
votes
1answer
25 views
HTML not updating after successful use of $filter(orderBy) in custom directive
I'm creating a custom directive called ngSortable that can use the orderBy filter on an array when the element is clicked. I've stepped through and confirmed the array is being sorted correctly, but ...
0
votes
1answer
38 views
How do I properly set a service property from model data in a controller in angularjs?
I've set up a service to share some data/state between multiple controllers. In one controller, I update some of the service properties with scope data through a save function. That data is then used ...
0
votes
1answer
23 views
different scope for array and angular copy
It is easier to see the question from this plunkr:
http://plnkr.co/edit/EFZCAXWFui0foMbfZkPb?p=preview
Click on 'Click to add first' and 'Click to add second', then you can click on the 'lock' icon ...
1
vote
2answers
20 views
Can't get ng-repeat to list out users in object | no error msg
I'm in the very early staged of learning Angular. This is the first controller I've written for a Sharepoint application I'm working on. Basically when the page loads, the controller is suppose to ...
3
votes
1answer
43 views
How do I resolve and assign an inner controller from the outer's scope?
Self explanatory fiddle: http://jsfiddle.net/5FG2n/1/
Say I have a view with two controllers, one containing the other. The outer controller is static, but I need to set the inner controller based ...
0
votes
0answers
11 views
Angular: issue when defining scope functions programmatically
In my controller, I want to define scope functions programmatically as in below
angular.module('App.controllers').controller('MyController', ['$scope', function($scope){
_.each(['name', 'address', ...
1
vote
3answers
44 views
Auto suggest with 20,000 entries
Hi I am building a form that uses autosuggest. The way it works is I load about 20,000+ customers into my angularjs app. Then when the user types into the input field the name of the customer they ...
0
votes
2answers
19 views
AngularJS: Take a single item from an array and add to scope
I have a ctrl that pulls a json array from an API. In my code I have an ng-repeat that loops through results.
This is for a PhoneGap mobile app and I'd like to take a single element from the array so ...
1
vote
2answers
27 views
Bind <div> to element of Angular controller
We have a somewhat complicated model on an AngularJS controller:
function controller($scope) {
$scope.model = {
childmodel1: {
childmodel2: {
property1: 'abc',
...
0
votes
1answer
19 views
Angular ng-include controller inside another controller
I have a situation where I have one angular controller, which basically just loads html templates depending on a click event. However, these templates are governed by there own controllers. This ...
0
votes
1answer
40 views
Why is the scope in my angularJS app empty?
I'm new to angular and am trying to tweek the tutorial to my app. I'm trying to add routes to my app and it doesn't seem to be reading my templates or reading the controller correctly. I installed ...
0
votes
1answer
47 views
anglar js setting model value from directive and calling a parent scope function holds on to the previous value inside that function
js fiddle http://jsfiddle.net/suras/JzaV9/4/
This is my directive
'use strict';
barterApp.directive('autosuggest', function($timeout, $http) {
return {
restrict: "E",
scope: {
...
0
votes
0answers
26 views
not getting the different controllers
Hello I have one HTML template name as a.html as below
<div ng-controller="a"></div>
in js file
app.controller('a',[$scope, function($scope)]){
// here i make some array and this ...
0
votes
2answers
32 views
Why doesn't my $scope reflect my controller being initialized?
Question:
Why is {{ name }} resulting in blank?
Plunker:
http://plnkr.co/edit/32t8u4VL9BiuhHcC80LF?p=preview
Script:
var app = angular.module('app', []);
app.controller('MainCtrl', ...
1
vote
1answer
51 views
Angular controller scope not updating after jQuery ajax call
i have this code and i can't see where is the source of problem, i don't get any error in the chrome console
my controller :
function notifController($scope) {
$scope.refreshMsgs = function () {
...
0
votes
3answers
30 views
AngularJS - accessing returned scope method variables in another method
I have an Angular app with a service and a contoller:
service.js
.factory('MyService', function ($http, $q) {
var api_url = 'http://localhost/api/';
var MyService = {
list: ...
0
votes
2answers
26 views
$watch listener being called once without change in expression
In my controller I have a variable called datetime which is updated by a timer every second. I need to do some work when the day changes, so I registered the following watcher:
...
0
votes
1answer
18 views
Displaying scope variable before view tag with Angular
I'm using Angular with the Ionic framework to build an app. I want to display the title of the previous screen in the header bar, next to the back button. Like so:
[ '<| title of previous screen' ...
0
votes
0answers
39 views
$Parent Scope causing problems in Sub pages
I have a following problem.
My Upload file action made into Sub page/Controller which is included in Main page. If there is only one Upload Sub page everything works well. But I need also a second ...
3
votes
0answers
236 views
React compared to Angular directive with isolate scope
I have read Facebook and Instagram engineers saying that React itself lack of infrastructure to build a big project, it is only the V in MVC. Instagram seems to use it with some Backbone code for ...
0
votes
1answer
26 views
AngularJs ng-if function call from same controller not working
<div ng-repeat=" x in z">
<div ng-if="function(x).y" >
display this
</div>
</div>
In the above code, ng-if function(x) is not getting called without ...
0
votes
1answer
8 views
Open new route with same filter applied
In my angular app I have a ng-repeated list with a custom filter.
I would like to provide the possibility to open the filtered list in a new browser window with a print layout.
Is there any way to ...
0
votes
1answer
19 views
Ng-Include, Prototypical Inheritance and Objects Vs Primitives — Weird Behavior
My overall question is: is this expected behavior?
I have a demo here: http://plnkr.co/edit/RMGKxVMsbO6tOI1ftftQ?p=preview
I have a string, a bool, a integer printed three times in three different ...
-1
votes
3answers
53 views
Call another controller from inside ng-repeat
I am new to angular and I am trying to call a function from another Controller. I do not want to define an addIssue function in ItemsController which calls IssuesController.addIssue or share a ...
-1
votes
1answer
20 views
How we can set different properties to the rootscope [closed]
I have multiple views loaded.Each time I have set the rootscope values
$rootScope.value="1";
In other controller i want to use this property at that time i am not able to access these properties. ...
0
votes
2answers
23 views
Angular function with ng-if rendering figure
In my showCtrl I have this
$scope.showTeam = function(){
var count = 0;
for (var k in subordinates) {
if (subordinates.hasOwnProperty(k)) {
...
0
votes
0answers
28 views
Don't know how to remove the console errors in angular ui select2
I created a plunkr (http://plnkr.co/edit/71ZlPcqsfRON5wjMM1He?p=preview) to see how to work with angular ui select2
I successfully made it work , but then I am getting two errors
1) ngModel is ...
0
votes
1answer
33 views
Selected option in select box with angularjs
I have an application developed using Codeigniter and AngularJs. I want to set a default item in manual select box, but angular adds an empty undefined item.
<select class="form-control" ...
0
votes
2answers
29 views
Count Elements in Object
App.posts = function($scope) {
$scope.posts = [
{
name: '',
elements: [{element1: ''},{element2: ''}]
}
]
$scope.count = $scope.posts.length;
});
How can I count the elements in each post? ...
0
votes
1answer
13 views
angular-phonecat application using Node.js error 404 Not Found: /app/index.html
I am running http://docs.angularjs.org/tutorial/step_00
on my windows machine
It was working fine till yesterday.
Today it is giving following error
404 Not Found: /app/index.html
0
votes
1answer
44 views
retrieve form valid state in an ng-include
I have a form that I create using an ng-include. I'm trying to retrieve it's state outside the scope of the ng-include. What is the best way to watch the value of userForm.$valid in the child scope ? ...
0
votes
2answers
31 views
how to access object property via isolate scope without two-way binding?
I want to pass a product's id to a directive like so:
<widget product-id="product.id"></widget>
I prefer not to use curly braces:
<widget ...
2
votes
2answers
34 views
background default image if ng-style image loaded is invalid url
I am adding background images to my div like this
ng-style="{'background-image' : 'url('+ myvariable.for.image +')'}">
where myvariable.for.image is a url like /examplesite/image/id
This works ...
2
votes
1answer
54 views
angularjs apply filter cross nested directive (filter also apply on child even it doesn't match parent)?
I am new to angular, just created a angular tree with search filter... It loads nested data then fetch as a tree.
I would like the filter will also apply on child node even it doesn't match the ...
0
votes
1answer
20 views
AngularJs ServiceMethod with more parameters
in my controller I have this method:
..............
angular.extend($scope.criteria, $scope.items);
angular.extend($scope.criteriaList, $scope.itemsUpdate);
...
1
vote
1answer
45 views
How do I correctly check form validity within a watcher when model data is changed outside of the form in angularjs?
I'm still quite new to AngularJS and I think I'm having trouble understanding the timing with $scope. In a controller, I've setup a watcher for some model data that is bound to various form elements. ...
1
vote
0answers
17 views
How to implement a AngularJS Google Images style rows with center content bar
I have an angular app with rows of four boxes followed by a sliding div that opens and displays information from the above boxes. I first tried
for (var i = 0; i < data.length; i++) {
if(i % 4 ...
0
votes
0answers
13 views
angularjs accessing form data for nested forms
Ok, so I have nested forms and now would like to get the data for an ajax submit. What is the best way to get the data?
I've created a jsfiddle to show what I mean:
...
0
votes
2answers
18 views
AngularJS and nested forms: Correct way of naming and declaring model
Ok, so I am creating a form like so:
<form novalidate class="simple-form" action="" name="mainForm" ng-submit="doSubmit()" method="POST">
<div ng-form name="giftForm" ...
0
votes
2answers
17 views
$compile is loading images before the string is even evaluated for Angular expressions
I am building a service to handle modal windows in my Angular application, so there is a bit of manual work with linking a template, scope and controller.
I'm using $compile like so, to build the ...
0
votes
3answers
69 views
Angular ngClick cannot access variable in a different scope
I am completely new to Javascript and especially AngularJs. Here is my problem, I need to call ng-click function inside ng-repeat to hide a some html outside of it.
As I understand the problem is ...
0
votes
0answers
34 views
AngularJs Manage Cookies
In my controller, I have this:
$scope.selectedItems = [];
$scope.getElementCart = function (){
...
0
votes
3answers
31 views
Can I replace scope for isolated scope?
I have directive in which I have scope mentioned as :
return {
restrict: 'AE',
transclude: true,
scope: {
model: '=',
menu: '='
...
1
vote
1answer
27 views
grabbing just required results from json — restangular
I am trying to grab just few ids from json and not the complete payload of json. Is that possible? here is my code
Car.controller('IndexCtrl', function ($scope, CarRestangular) {
$scope.cars = ...
3
votes
3answers
58 views
Why I can't access the right scope?
html:
<!doctype html>
<html>
<head>
</head>
<body>
<div ng-app="project">
<div ng-controller="mainCtrl">
{{ property1 }}
<br />
{{ ...