Tagged Questions
0
votes
2answers
24 views
How can I get a change to the Model (from within a Directive) to update in the View? $apply?
There are a lot of questions/answers here on stackoverflow and out on google about this topic ($apply), and I feel like I have read every one and followed them, but to no avail. All my searches on ...
0
votes
1answer
10 views
Generate new $index for array items per specific key:value in Angular
Please be patient if I don't understand something and need clarification as I'm still new to Angular, and please simplify explanations for an Angular newbie if you can, thanks!
I am working on a ...
0
votes
2answers
30 views
Pass a input field value into angularjs $resource undefined and error shows unknown scope provider
===========================================================================
Update 1
Fixed code produce new error of
ReferenceError: inputName is not defined
on the line of
...
0
votes
0answers
9 views
How to maintain session of login page to all other partial pages in AngularJS
I am doing project where i have used AngularJS. Using angular i have done routing with some partial pages with different controllers.
/ProjectRoot
/css
/js
angular.js
...
0
votes
0answers
23 views
Have $watch trigger other function in object
I want to have an object which can listen to certain parts of it using $watch but then call another member function whenever the watch is triggered. I'm not sure if the way I am currently approaching ...
-1
votes
2answers
33 views
AngularJS get data from json
I'm trying to get from Json data but it doesn't worked for me. I'm not sure what I'm doing wrong.
Angular Ajax API call :
<script>
function PostsCtrlAjax($scope, $http) {
$http({
...
2
votes
3answers
22 views
AngularJS binding response from server not updating in view
I am developing a mobile application. I encountered a problem while trying to relay messages in the view that was returned from the server after an ajax call. The idea is to display the message in the ...
0
votes
2answers
11 views
How do you call a parent directive controller from a child controller (not link method)
I would like to access my parent directive from within my child.
I know that if you use the require property, then the link method has the parent controller passed as a parameter, but how can i ...
0
votes
0answers
16 views
AngularJS - Filter HTML character references
I have a set of JSON responses/results that i display to the front-end.
Some of these contain HTML character codes, for example:
<b>Some Text</b>
Rather thank using ngSanitize, can i ...
0
votes
1answer
20 views
Preserve scope values while moving template in ng-repeat
I have two collections binded to ui that populate through ng-repeat
In that I have included ng-include="template.html"
<div>
<div ng-repeat="item in items1">
<ng-include ...
0
votes
0answers
20 views
angularjs ajax call wrapped by $scope.$apply function preventing ng-click from being executed
I have and custom validation directive which triggers on change to validate user input:
link: function(scope, elem, attrs) {
elem.on('change', function() {$scope.$apply(function(){
...
1
vote
1answer
23 views
angularjs and ng-init scope when data changes
So I have a calendar application where right now the user chooses start/end dates and clicks update calendar. This populates a calendar. However, I'm having trouble including new elements in the ...
0
votes
2answers
25 views
AngularJS: scope change in ngClick gets lost
I have ngClick and ngClass on an element duplicated by ngRepeat:
<li
ng-class="{'active': $parent.mem.A == $key, 'not-active': $parent.mem.A && $parent.mem.A != $key}"
...
0
votes
1answer
21 views
Detect if a function is bounded to the scope with &
I have a directive popup that has an isolated scope with only a function binding in it:
Template
<popup>
<div class="confirm-button" ng-show="showConfirmButton" ...
3
votes
3answers
27 views
Using $scope.$watch when using `this` scope in controller
I have a controller in my Angular app:
(function (angular) {
function MyController() {
this.name = 'Dave';
// I want to have code like this:
/*
...
0
votes
1answer
37 views
Angular JS Use modal in ng-repeat list
I am displaying a list using AngularJS's ng-repeat... Below is the template per list item; It all works except for the {{...}} that are used inside bootstraps modal. It 'almost' works the way it ...
-1
votes
0answers
12 views
Change module config data from controller - AngularJS
I have implemented Session timeout using AngularJS
Below is code:
var user = angular.module('user', ['ui.bootstrap', 'xeditable', 'ngIdle']);
user.config(function($httpProvider, ...
0
votes
0answers
13 views
AngularJS - ngTouch Error: element.on is not a function
I have just added the mgTouch module into my application. The majority of the project is working as expected, however on page load where i have the following 2 buttons, i see the following error:
...
1
vote
1answer
21 views
Trouble getting size of an array in a js object inside controller
I want to get the size of some data I am retrieving in my controller - I have tried the following code; both utilizing a new Object.size function and attempted to get the length property directly ...
0
votes
1answer
12 views
Add Properties after json load
I have this json:
{
"info": [
{
"id": 999,
"products": [
{
"id": 1,
},
{
"id": 2,
}
]
}
]
}
Info
-- products
-----id
And my factory:
AppAngular.factory('model', ...
0
votes
1answer
10 views
Can I isolate only one property in a directive, with the rest mapped to the parent scope?
I created an angular directive to make generating forms easier.
It looks like this:
function formGroup() {
return {
restrict: "E",
replace: true,
scope:
{
...
0
votes
2answers
25 views
Scope issue in $http success callback
I'm using PHP to get data into my factory, which shows correctly in the success callback function within the controller. However, even after assigning the returned data to $scope.customers, it's not ...
0
votes
1answer
12 views
AngularJS nested directives, inner directive's ng-click is not firing
This is a problem I'm having in my app and I am about to reproduce it in a simple example:
<div f-outer>
<div f-inner dat="dat">
<a href="javascript:" ng-click="run(dat, ...
0
votes
2answers
30 views
Angular. Ambiguous $watch behavior for sync and async code
I have an exapmle where value for watched variable can be set in current stack or can be loaded asynchronously (it is incapsulated code). So, i can not be sure, if the value was changed, when the ...
2
votes
2answers
21 views
How to redirect to a different template based on the scope in AngularJS?
I would like to have a different template based on my scope.
Currently, I have only one template named : view-project.html accessible by this url : #/project/:id.
Now, I need two templates : ...
0
votes
1answer
12 views
ng-click on firing on mobile or tablet devices
On page load i have a controller that calls a service and then binds the returned data to some $scope.objects:
app.controller("MainController", function($scope, $http, serviceGetData) {
...
-1
votes
4answers
25 views
Updating scope on form submit
I have a form that upon submit will POST a message to our REST API. If successful, the REST API will return the updated value in the same JSON format as the GET call makes. For some reason, even after ...
-1
votes
0answers
13 views
On application start, how do I prevent controllers from running until application run block completes?
In my application run block I'm sending GET requests for data, attaching them to some services, and then running my application. In one of my team-detail.html views, I'm filtering from this repo of ...
-1
votes
1answer
11 views
Watch form validity from parent controller
I have a form within my controller. I'd like to be able to set a scope variable based on the validity of this form. I've given the form a name already:
<div ng-controller="myCtrl">
...
...
-1
votes
0answers
18 views
Kendo UI Grid Error messages not appearing in UI-Bootstrapper Alert ng-Repeat
I am trying to handle Kendo UI errors gracefully by displaying a UI-Bootstrap Alert with the error message in it.
View - Index.html
<alert ng-repeat="alert in alerts" type="{{alert.type}}" ...
-1
votes
0answers
11 views
Controlling if the element already exists in the Array
I have the following function that adds an element in the array:
$scope.listCart = [];
$scope.total = 0;
$scope.addCart = function( o ) {
if ( $scope.listCart.length > 0 ){
...
0
votes
1answer
22 views
Get the HTML output from an Angular template in javascript
I have an angular template that I would like to be able to access the processed HTML from within a javascript function.
If for example the template was under a templateUrl
"/scheduler/tooltip.html"
...
1
vote
3answers
36 views
AngularJS - How to filter date in controller
I have a JSON file returning a number of dates in such format:
/Date(1235548800000)/
How can i filter this in my Controller to only return the year?
I have tried:
var filteredDate = ...
0
votes
1answer
33 views
how to load html in while making pop over?
I make a pop over .But I insert my pop over content in same html file.I want to load popover contend from another file and load the contend using templateURl :can we do that ?
Here is my demo
HTML:
...
0
votes
1answer
24 views
Advice on workflow for an 8 step application with ANGULAR.js
I'm creating an application with Angular.js and I'm getting a bit confused of how to use Angular to make it.
Below, you can see a preview of what I have for the moment, it's ugly but it works.
I ...
-1
votes
0answers
19 views
How can I pass the scope from addbatch to directives?
How can I call the scope from directives? I have an addbatch controller. I'm going to pass the method this.getClientNames() to super.activate, then I have a method getClientNames, but there is an ...
0
votes
0answers
27 views
AngularJS variables not binded inside form tag
Im working with AngularJS and something really weird happens.
In the same HTML file I have the following two lines of code:
<img id ="image_displayed" src='{{rootContext}}/images/{{team.imgUrl}}' ...
2
votes
1answer
43 views
Global back/next buttons in AngularJS
I have some navigation buttons on an Angular wizard-style webapp. For cosmetic reasons they need to be removed from each partial and added to the root "index.html":
<!-- Global navigation buttons ...
1
vote
3answers
24 views
Angular not selecting radio button from model
I'm working on system where I have an ng-repeat populating from an array of elements, with a radio buttons setting a property. When it loads in, none of the radio buttons are selected, but when I ...
0
votes
1answer
22 views
How to bind to the result of a function in AngularJS
I have an array of items that I want to keep track of across several controllers. So, to do this, I made a service.
The service is basic for now, just adding items to an array and the ability to get ...
0
votes
1answer
35 views
How can I add each element of one array to corresponding elements in other arrays with javascript or angular
I need to add the elements of arrays together in order, very similar to the question at [How can I add each element of one array to another one's corresponding element using a ParallelStream?, but ...
0
votes
0answers
19 views
Why is ng-class not working on my directive when I change a scope variable by using broadcast? [duplicate]
I have a directive which is a toggle button to change the theme of the page.
The code for the directive is...
app.directive('twoOptionThemeSwitch', function () {
return {
scope: {},
...
0
votes
1answer
23 views
$location.url and $scope.$apply = Cannot read property '$$nextSibling' of null
We have a service handler that changes the location. The location does not change until something else triggers a digest. So, I used $apply, but getting errors from that.
$scope.myFunction = ...
0
votes
2answers
52 views
How to get a $scope object to an angular service
I have an object that I am modifying on $rootScope where I am "storing" my last search parameters. Currently I have the values returnType, rows, and query hard coded. I would like to those just be ...
0
votes
5answers
39 views
AngularJS - Filter empty objects
I have a $scope.myData object that contain a chunk of data. What i am trying to do is display the data but filter out the nulls and empty strings:
$scope.myData = [
{
"ID" : "001",
...
0
votes
1answer
17 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 ...
-1
votes
1answer
20 views
Call a function when i click outside to the element like boot strap modal get closed
I have created a popup box of div. Which get shown when i click on an icon and get hide when i click on close button. But i want to get it closed id i closed out side of that popup. What i can do for ...
0
votes
2answers
33 views
How to assign scope in a promise?
I want to assign a value in my scope into a promise (in an http.get) but my value isn't assign to my scope ! I've tried many things (use $scope instead of this.scope in my controller) but it doesn't ...
0
votes
2answers
26 views
Angularjs - watch all directive scope attributes?
I have a "bar chart" directive in Angular that I want to re-render anytime one of its many scope attributes change.
I am wondering what my options are in terms of watching the scope ...
As the render ...
0
votes
2answers
52 views
How do I allow for clicking on each item/post, then viewing it in a new screen?
Im trying to build a simple tutorial app list of grocery items, and then clicking on it will lead to a new page showing the grocery goods in details, such as price, quantity left etc.
Currently, ...