In AngularJS, a scope is an object that refers to the application model. It is an execution context for expressions.
1
vote
1answer
25 views
Ng-repeat to Jquery Cardslider
I'm having some trouble using ng-repeat into a cardSlider, I'm using an external data source, in which data is pulled out perfectly, I've used this on tables but on the process of binding it with the ...
1
vote
1answer
14 views
WYSIWYG shortcode to AngularJS function
I have a custom WordPress shortcode that when used in a WYSIWYG returns a bunch of html with an Angular function attached.
Below is an example of what I am trying to do.
Shortcode:
add_shortcode('...
0
votes
1answer
25 views
cannot access directive's scope object in directive's controller
MaterialIn.directive.js
angular.module('mdt')
.directive('mdtMaterialins', materialInsDirective);
function materialInsDirective() {
return {
restrict: 'E',
scope: {
...
0
votes
0answers
22 views
Angularjs array changes its syntax when it has only one record
I am using an angularjs array to store the record data(table rows) received by using the http.get rest API and printing using an ng-repeat. The problem is whenever there is only one record retrieved ...
1
vote
2answers
58 views
Angular array doesnt show the data when it has one record
I am using an angularjs array to store the record data(table rows) received by using the http.get rest API and printing using an ng-repeat. The problem is whenever there is only one record retrieved ...
9
votes
3answers
21k views
how to set dynamically height to element?
I am trying to set dynamically height to element in my demo .I will tell you issue I am taking static or constant value of height in my demo .I take 250px constant value
#wrapper{
background-...
0
votes
0answers
10 views
not working Display blob (.pdf) in an angular app
i am done pdf download in my app. the pdf file is download successful but some error gets this:
Failed to load PDF document
here is my js code:
$scope.downloadFile = function () {
$...
0
votes
3answers
20 views
How to ng-if use when its value is “”?
How to use ng-if? I have below code. If image_path not null show td otherwise not. My code does not work.
ng-if="hs.image_path != """
<td ng-if="hs.image_path != """><img id="...
37
votes
4answers
17k views
AngularJs broadcast repeating execution too many times
Inside one of my Angular controllers, I have this:
// controller A
$rootScope.$on("myEventFire", function(event, reload) {
someAction();
});
In another controller I have this:
// controller B
$...
0
votes
0answers
25 views
Write data from input to Firebase database
I wanna send data from input towards Firebase database using $scope. I don't know how can I send from $scope all data towards firebase database.
Here is the html code :
<div ng-app="angularjs-...
0
votes
0answers
32 views
Not able to use a two-binding in Directive in angularJS
I am using a controller like this
app.controller('EmployeeCrtl', ['$http', '$scope', function($http, $scope) {
$http.get('/Data/EmployeeDetails.json').success(function(data) {
$scope....
-3
votes
0answers
34 views
Pass data (GET or POST) to angular 2 project
The angular project running on
localhost:4200/auth
/auth has code to receive post parameter.
A another simple html file outside Angular project is sending post data to localhost:4200/auth.
The ...
0
votes
3answers
537 views
AngularJS - Child controller private scope (preventing inheritance)
I have a case where I need to nest controllers. I do not want the child scope to inherit from the parent scope because I have scope variables with the same names in both controllers. Is there a way to ...
88
votes
8answers
212k views
AngularJs: Reload page
<a ng-href="#" class="navbar-brand" title="home" data-translate>PORTAL_NAME</a>
I want to reload the page. How can I do this?
1
vote
3answers
59 views
Angular JS Adding options to drop down menu on ng-click not working properly
I am pretty new to angularJS. I am trying to create an interface for the user where he will be able to select exactly two items from two drop down list. They are actually the same options. When the ...
1
vote
2answers
32 views
How to refresh directive that existed in template and directive has own scope for data
I have - ng-view - template create item functionality and same template containing one directive that load the saved items.
Now, when i do save create item and immediately, its not refreshing list of ...
3
votes
1answer
3k views
How to update Directive on State Changes
I have a root state that defines the overall structure of the Angular template. In the root state, I have the sidebar included that has dynamic menus via directive that changes based on the state. ...
0
votes
1answer
28 views
passing parameter to directive in Angularjs
I have the following directive:
angular.module('SuperCtrl').directive('listDirective',function(){
return {
restrict:'E',
scope: {
title:"="
},
templateUrl: '../templates/...
1
vote
2answers
1k views
Deregistration of event handlers in Angular
I saw a piece of code in a controller recently that went something like:
.controller('foobar', ['$scope', '$rootScope', function($scope, $rootScope) {
var eventHandler = $rootScope.$on('some-...
0
votes
0answers
14 views
Does it ever make sense to use $scope.$new(true,scope)?
An Angular $scope has the method
$new(isolate, parent) where:
isolate (boolean): If true, then the scope does not prototypically inherit from the parent scope. The scope is isolated, as it can not ...
0
votes
2answers
35 views
What method should be attached to $scope?
I am new to AngularJS, and have WPF MVVM experience before. Now, I'm very confused with $scope, it looks like it is a viewmodel, we can define functions on it and use ng-change, ng-click or some other ...
-4
votes
2answers
2k views
Angular to display last 12 months dates
I am trying to write simple ng-repeat that displays a list of the last 12 months, from today.
So for example, if i load my application today (May 2014), i will have a list of:
May 2014
Apr 2014
Mar ...
9
votes
4answers
15k views
function called twice inside angularjs controller
I am new to angular js and currently stuck with very wired kind of a bug. function in a controllers runs twice when its called by view loaded against a route.
http://jsfiddle.net/4gwG3/5/
you will ...
0
votes
0answers
17 views
View updating intermittently between page loads with an array change in angularjs
I have two components (contacts and notes) loading on the same page (from the main component) which both have simple http requests to add and delete information. They are only updating the view ...
0
votes
1answer
34 views
AngularJS - Update controller var on route change
I'm pretty much a newbie in the AngularJS world.
This is my problem. I would like to update the selected tab based on the url, so that the selected tab changes when the url changes.
This is my js:
...
1
vote
2answers
35 views
Why will always use anonymous function in AngularJS
I see almost tutorial use anonymous function in AngularJS, instead of normal function, like function name(para1) {}. Please see this link: http://www.w3schools.com/angular/tryit.asp?filename=...
858
votes
14answers
359k views
How do I access the $scope variable in browser's console using AngularJS?
I would like to access my $scope variable in Chrome's JavaScript console. How do I do that?
I can neither see $scope nor the name of my module myapp in the console as variables.
791
votes
6answers
612k views
How do I use $scope.$watch and $scope.$apply in AngularJS?
I don't understand how to use $scope.$watch and $scope.$apply. The official documentation isn't helpful.
What I don't understand specifically:
Are they connected to the DOM?
How can I update DOM ...
1
vote
1answer
17 views
nested ng-repeat in angular js not showing anything
i am having this inside my controller method.
var employee = [{name:"ankur",dept:"IT",company:"wipro",under:[{name1:"ashish"},{name1:"akash"},{name1:"tyagi"},{name1:"mogra"}]}];
$scope.employee = ...
1
vote
3answers
38 views
How to show a title from an array in each state with ionic?
I'm trying to make a playlist app with ionic, and I would like to show on each state by id the title (this is a starter app from ionic sidemenu template, without many changes from the beginning), here ...
1
vote
2answers
38 views
AngularJS - directive scope model doesn't update without debugger
For create/edit a website content I have a form with some tabs (buttons making the idea of tabs system because the user may want to add another "tab", etc, etc) and I use a directive to show the ...
2
votes
3answers
27 views
Simple controller make angular doesn't work
Hello I am learning angular 1 and I have problem at the very beggining.
I'm trying to display data with table in ng-repeat using controller. Angular in app stops working at all even {{ 2 + 2 }} on ...
1
vote
0answers
24 views
how to perform three stage filtering of $scope in angularJS?
I would like to perform a 3 stage filter on my $scope, for example:
So firstly user would choose a Course code which would narrow the results down, then
the next select box (Occurrence) would ...
47
votes
7answers
60k views
Simple ng-include not working
Im playing with AngularJS for the first time, and im struggling to use ng-include for my headers and footer.
Here's my tree:
myApp
assets
- CSS
- js
- controllers
- vendor
...
0
votes
0answers
68 views
Possibly unhandled rejection in a karma unit test
I use jasmine to write a unit test for a controller, where I have to check whether a function worked on $scope.$watch. I use 'controller as' syntax, but I've injected $scope to create a watcher. ...
2
votes
2answers
911 views
using $rootScope in templateUrl function
I just started with angularJS and I have a question:
How can I access a variable defined with $rootScope in a templateUrl function?
Here is my code:
myApp.config(['$routeProvider',
...
0
votes
2answers
21 views
filting through 2 properties using custom filter angularjs
I am trying to filter through multiple properties in Angular. I am able to filter through one property easily by using an angular filter:{ title: searchString } but to filter through a multiple ...
3
votes
4answers
415 views
Why is it that I see {{ … }} before loading in AngularJS?
Do you know why is the {{ project.title }} before I see the real value of the scope.
And how to solve that ?
EDIT : <title>{{ pageTitle }}</title>
Page is loading
Page completely ...
0
votes
1answer
26 views
Passing div id to directive in angular
I have the following directive:
.directive('addfields',function($compile){
return function(scope,element){
element.on("click",function(){
var enviroElement = angular.element('<enviro-...
0
votes
0answers
31 views
how to attach excel file on send email in angular js
i am used angular js for creating excel file but now i include also that file in my email from how to that possible.
my js code:
$scope.email = function () {
var blob = new Blob([...
0
votes
1answer
24 views
Modify variable of parent controller inside child controller AngularJS 1.x
I have my body controlled by a MainController. In the body, I have another nested controller. In my index.html, I have a div element controlled by the nested controller:
index.html
<body ng-...
1
vote
1answer
37 views
Change in ng-model value getting changed in the other Parts of the list also
I have a view which i am displaying to the user it is a Result list and i'm displaying it on the screen. From view user will be able to click on hyperlink that will allow him to modify that particular ...
1
vote
1answer
18 views
Angular 1.X - Accessing controller variable through directive using $watch
Within a controller I have an ajax call that populates $scope.main_data. I want to within a directive get that data when it populates. However the two issues I'm having is:
I cannot seem to access $...
0
votes
1answer
22 views
Filter through multiple properties in AngularJS
I am trying to filter through multiple properties in Angular. I am able to filter through one property easily by using filter:{ title: searchString } but when I try to use multiple properties... it ...
2
votes
1answer
815 views
Scope problems in basic Yeoman Angular Todo App
I'm following the tutorial here: http://www.youtube.com/watch?v=iUQ1fvdO9GY while learning yeoman and angular.
I've gotten to here http://www.youtube.com/watch?v=iUQ1fvdO9GY#t=266 and where his ...
0
votes
1answer
26 views
inserting a directive every time a button is clicked
I am working from a tutorial here: https://fourtonfish.com/blog/2014-01-dynamically-add-directives-in-angularjs-no-jquery/
However, I want to create a directive and inject this into my HTML every ...
0
votes
0answers
19 views
angularjs ng-repeat autonumber increment from multiple arrays
I have this ng-repeat:
<div ng-repeat="prop in props">
<div ng-repeat="tenant in prop.Tenants">
<label class="col-md-6 control-label">Tenant {{$index?}} ({{tenant....
0
votes
1answer
36 views
Value of ng-model getting changed when we change value for particular record
I am populating my response from REST API using AngularJS on the front end by using ng-repeat . I'm Providing user with an option to modify each result that is displayed on the screen . When the User ...
2
votes
1answer
34 views
How can I use one service to update both the parent and child scope in AngularJS?
I am trying to implement services more in my code and would like to use only one service that updates data in both ParentCtrl and ChildCtrl at the same time.
I have read that services are singletons ...
849
votes
13answers
400k views
What is the difference between '@' and '=' in directive scope in AngularJS?
I've read the AngularJS documentation on the topic carefully, and then fiddled around with a directive. Here's the fiddle.
And here are some relevant snippets:
From the HTML:
<pane bi-title="...