In AngularJS, a scope is an object that refers to the application model. It is an execution context for expressions.
9
votes
1answer
11k views
What is the default for AngularJS directive scope?
What is the default scope value of an AngularJS directive?
Of course, it is not isolated scope. It is true or false.
I can't find any documentation on what it is.
0
votes
1answer
16 views
how to iterate through an array and display it in $scope (angularjs)
Problem:
I am showing a list of documents in my application and one of the fields is a preview icon which shows a modal to display a pdf preview of the document. I am building a url to make it ...
0
votes
0answers
22 views
Weird behavior with this and $scope in controller method
Well, I am new to angular and my prior searches showed me that using 'this' is different from '$scope', inside a controller. Bearing that in mind, I decided to only use scope in my application, which ...
1
vote
2answers
18 views
Passing scope parameters to a Custom Directive as ng-src is being called repeatedly
My current implementation is shown below which is working but as the getImage method is inside expressions its being called repeatedly when any text change or data is entered on the page
HTML
...
0
votes
0answers
10 views
Angular Directive Transclusion Scope Issue
I am creating a custom directive as follows:
<directive-a attribute-a="customData" attribute-b="customKey">
<!--Transcluded Content-->
</directive-a>
The scenario is as follows:
...
1
vote
0answers
30 views
understand child scope angular
i try understand scope angular.I see the docs write
childScope.aString = 'child string'
The prototype chain is not consulted, and a new aString property is added to the childScope. This new property ...
0
votes
2answers
42 views
Implement Authorization in AngularJS
I want to implement authorization in AngularJS. In my project which is some kind of social media, different roles or even same roles may see a view file differently.
For example imagine we have two ...
0
votes
2answers
23 views
how to remove object from $scope. variable angularjs
How to remove one object from $scope.Profile.address object please help me see below code and image
<tr ng-repeat="x in Profile.addresses">
<td><input type="text" class="form-...
0
votes
3answers
40 views
AngularJS - Conditional attribute not working with variable?
Below is my Angular Controller
Angular JS
var multistage = angular.module("multistage", []);
multistage.controller('groupStanding', function($scope1) {
$scope1.grouplimit = 3;
$scope1....
0
votes
1answer
26 views
Array Object in a scope showing empty while reading in a child html page- angular JS
I have an array object in my angualr js file which while trying to console showing the results in js file. When I am trying to use the same object in a html file it is shown as empty.
Here is my code ...
0
votes
1answer
18 views
Directive callback executed after ng-if removes directive from scope
I have an angular directive on my page, within ng-if.
I have a service which exposes a function that receives a callback as a parameter. Let's call this function functionX.
When the ng-if expression ...
0
votes
1answer
27 views
Change nested views through ng-click in ui.router
I am trying to insert views inside view. But it is working only at the defined state but when I trying to change the view with the help of ngClick the state lost the path.
It is like
View 1
--...
0
votes
1answer
27 views
select value not selected in angularjs
I have this html markup:
<div ng-repeat="prop in props" style="margin-bottom: 10px;">
<label class="col-md-4 control-label">Property {{$index + 1}} ({{prop.AddressLine1}})</label&...
0
votes
0answers
10 views
Upload image shows error “Cross-Origin Request Blocked” [duplicate]
When I use the logic below it causes following error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading
the remote resource at
http://www.example.com/images/...
0
votes
2answers
31 views
angularjs ngmodel value with two values
I have this dropdown control
<div ng-repeat="prop in props" style="margin-bottom: 10px;">
<label class="col-md-4 control-label">Property {{$index + 1}} ({{prop.Value}})</label>
&...
0
votes
1answer
24 views
how to upload file using Angularjs, multipart/form-data
i want to upload image using Angularjs anyone know how do this..REST API wants
Content-Type:multipart/form-data
www.abc.com/images/id
Request Body
{
// --Boundary_1_1626119499_1392398808202
...
2
votes
2answers
10k views
Is there any way concatenate the variable name with a string or it is basic programming Mistake
I am working on an AngularJs app. I have an array of HTML select tags where I am concatenating the ng-model name and the options list name with a variable. He re I have two list or arrays. the first ...
2
votes
2answers
24 views
Iterate over subscriber
I'm having a bit of a problem understanding the observer / subscriber model and looping through that return.
So I've got a cocktail component that grabs an array of cocktail objects.
The core of ...
33
votes
6answers
92k views
AngularJS - get element attributes values
How do you get an element attribute value?
e.g.
HTML element:
<button data-id="345" ng-click="doStuff($element.target)">Button</button>
JS:
function doStuff(item){
angular....
28
votes
1answer
11k views
AngularJS Directive element method binding - TypeError: Cannot use 'in' operator to search for 'functionName' in 1
This is the controller of the main template:
app.controller('OverviewCtrl', ['$scope', '$location', '$routeParams', 'websiteService', 'helperService', function($scope, $location, $routeParams, ...
1
vote
2answers
110 views
why ng-show not working correctly in angular?
I want to show a drop down when user click on icon .I use ng-show but it is not displaying the drop down menu option.
I make a icon ... .on click I try to open drop down menu using ng-show .but it ...
0
votes
1answer
25 views
Get bound object value of angular component from its controller
I have an angular component:
module.exports = {
bindings: {
vulnerability: '<',
},
controller: ['$scope', function($scope){
//want to get value of vulnerability from ...
10
votes
1answer
14k views
How to show images in img tag inside an ng-repeat while using Angular JS?
My problem:
I want to display a list of images, stored localy, using ng-repeat directive, but the images re not being displayed.
AngularJS version: 1.2.22
The code:
Directory Structure:
myapp/
|...
0
votes
2answers
20 views
Use a directive to display scope value and update scope
I have an array of vertex values that I loop over and display to the user.
The values are stored as a space delimited string, like this:
vrtx = ["10.3 20.3 10.5", "13.2 29.2 3.0", "16.3 2.3 20.2", ......
0
votes
0answers
8 views
Return App Control for angularjs from Express.js render to Jade page
I am starter for that subject and I could not any sample code for this problem.
Now I dont want showing any like this code
<script src="controller/fooCtrl.js"><\script>
in my renderer ...
0
votes
2answers
27 views
Angular dynamically change ng-repeat name
I have ng-repeat in my html. how I can add ng-repeat with dynamically changes name.
<div ng-repeat="category in categories"> //external repeat
<div ng-repeat="data in categoryData.{{...
1
vote
4answers
82 views
In Angular, how to get a form in $scope in controller?
Having these two files:
HTML:
<form name="registrationForm" ng-submit="registerUser()">
...
</form>
JS (inside the Angular controller):
$scope.registrationForm.confirmPassword.$...
23
votes
6answers
24k views
Get controller name from $scope
Is there a way to get the controller name from the current $scope in AngularJS?
0
votes
0answers
42 views
Angular.js - Redirection is cleaning my $scope(?)
I have an $ngController that is being used in two views. The first view has an <table> with ng-repeat that lists all my data from the db.
I get the selected object form the table by using get($...
8
votes
5answers
17k views
angularjs: $scope update when I change a select with jQuery
I'm using a jQuery plugin to 'customize' my selects.
This plugin fires the change event of the original select when some option is selected.
The problem is that my scope doesn't change.
Here you ...
0
votes
0answers
32 views
Is there a way to alias scope variable for a html node?
I Have a directive myDirective which has a template and transcended html (transclude: true)
myDirective template has a repeater ng-repeat="item in transformSourceData"and transcluded template uses ...
-2
votes
0answers
20 views
Data is being passed to the page but isn't showing (Angular JS)
I can't seem to get my form data to show on my html page after submitting the form. The data seems to be passing, as I see it in my console.log as well as the unique ID gets passed in the url. What is ...
0
votes
2answers
42 views
Using scope which can be shared between all components in Angular
I have simple controller with one method:
app.controller('MyApp', function($scope) {
$scope.myMethod() {...}
}
I have also many components for input fields (for example for text input, number ...
0
votes
1answer
42 views
AngularJS ng-repeat issue and add row dynamically on button click
I want to create a simple form with some nested data. When I click the addSite() function, I want to create a new Site item and append it to my $scope.info.
I cannot create more than one form and the ...
17
votes
3answers
15k views
Setting focus on an input field after ng-show
Is it possible set the focus of an input field via a controller once data has loaded (via $resource in this case)?
The input is hidden via ng-show until the data is returned from the API but I can't ...
2
votes
1answer
18 views
Assign local storage value to $scope
I'm trying to assign local storage value to $scope variable and use that $scope variable in ng-model to initialize dropdowns. im trying the below code and it is not working.
Here is the plunker: ...
0
votes
2answers
28 views
select by default value for dropdown not working by using 'track by' in angualrjs
I am using track by to avoid strange values ::string that are appending to value but when i select by default dropdown , dropdown is not getting selected..
this is my plunker
Example Plunker
0
votes
0answers
11 views
How to avoid compile errors in Angular when service functions are used inside the view?
I have Access service functions such as Identity.role() inside the view of 'product' state in order to switch HTML depending on user role. When the user logs out, session kept in $localStorage is ...
0
votes
2answers
31 views
AngularJS: How do I get a variable from a $http. to another controller?
I have been working on an angularjs webapp using WS of moodle to get information, I have a little problem with variables, I would like to get a variable from a $http. and I saw that you can use ...
5
votes
2answers
3k views
Angular-grid when using $http to load json data
I am using ag-grid plugin in a project. I get json data using $http service. But the grid shows blank in web page. But when json data is applied directly, grid works. I think this is probably due to ...
0
votes
0answers
29 views
Angular (1.5) $compile with multiple scopes
When using controllerAs in Angular 1.5, you can refer to multiple scopes from the same chunk of HTML, for example:
<div ng-repeat="activity in landing.activities">
<draggable-action-item ...
0
votes
1answer
33 views
Angularjs push array to scope
I have problems to push an array to scope and empty the array after that.
I fire up the function ng-click="addInput() to add a new form to the Array $scope.info.sites = []; wich contains an another ...
0
votes
4answers
128 views
console.log for $scope in angular js
Why I'm not able to console output $scope values ? I'm trying to extract user assigned values from the pages and retrieve in controller. Eventually i would like to pass this to service so multiple ...
0
votes
0answers
20 views
Url change event when absolute url is change in angular
I am having url for
page1 : Application/Controller1/Action1
I redirect to page1 to :
page2 : Application/Controller1/Action1/#/SubAction1/40
Page 1 is in mvc.
Page 2 is in angular.
If i redirect ...
0
votes
2answers
32 views
How to bind a checkbox list using Angular and get all selected value from the checkbox using ng-reapet method
How to bind a checkbox list using AngularJS and get all selected value from the checkbox using ng-reapet method?
I am try to get the value of the selected check box in the angular controller.
View
&...
0
votes
2answers
52 views
how to save textbox values in scope variable angularjs
i want store textbox value in my Values variable but its not save i don't know why anyone help me please??? i am new in angularjs that's why i am here please help me i want store values from ...
0
votes
1answer
34 views
add unshift function not working in angularjs
Can I know why that my add function is not working after I create edit function. Supposedly, user will enter the data and click on plus button icon to add the data into the table. The data will be add ...
1
vote
3answers
43 views
0
votes
1answer
21 views
Access ng-model value in external js
I need to save ng-model value in string format and use it in an external js.Below is the code. I'm not able to save it in a string format.
<!DOCTYPE html>
<html>
<head>
<link ...
0
votes
1answer
25 views
how to get last index of array ng-repeat
how to get array last index + 1 using ng-repeat directive ??
dynamic Profile.addresses[2].site_name
<tr ng-repeat="lines in array">
<td>
<input type="text" class="form-control" ...