Questions tagged [angularjs-scope]
3274 questions
1
votes
0
answer
55
Views
ModalService $on & $broadcast multiple instances
These are the methods in the same angular controller.
The problem is that the $on is called every n clicks. So if it's the 3rd time i clicked to show the popup. The $on will run 3 times and the $broadcast once.
I'm trying to kill the $scope, but it's not working. It seems the controller ( which is a...
1
votes
0
answer
12
Views
After mdBottomSheet hide its remove ng-click fire
i insert in my code mdBottomSheet show and button that open it.
this is my mdBottomSheet code:
$scope.selectPhoto = function () {
var options = {
templateUrl: 'student-details/camera-buttons.tpl.html',
scope: $scope
};
$mdBottomSheet.show(options);
}
this is my button:
after i click the button the m...
1
votes
1
answer
194
Views
How to get selected values from custom drop-down using angularJS
actually I have been implemented one custom drop-down using & elements in my application. And right now I am able to select dropdown values by using mouse click but as part of functionality requirement, user able to select the drop-down values by using enter key also. So for this, I have been bind...
1
votes
1
answer
50
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 javascript controller doesn't get executed.
I have posted an example below.
My script is called from...
1
votes
0
answer
39
Views
AngularJS - When exactly is directive scope data first bound to the DOM?
I have a general understanding of how AngularJS processes directives however I'm unsure of exactly when data for scope properties is being bound to a corresponding expression in the directive's HTML template. My understanding of directive processing (in simplified terms) is like this:
AngularJs rece...
1
votes
0
answer
22
Views
Using Service to broadcast to Controllers or 2 way bind to Service from Controllers
I have an architecture question.
Let's say I have a notifications list that will be interacted with by many different type of controllers.
I know of 2 ways to do it, but can't seem to decide:
service('Notifications', function(){
var self = this;
self.notificaitons = [];
self.getNotificaitons(){
......
1
votes
1
answer
36
Views
AngularJS GET Object and Number
I'm trying to return a object from json API and I had a problem, I need to return '24h_volume_usd' from https://api.coinmarketcap.com/v1/ticker/?limit=0
but I used this expression =
$http.get('https://api.coinmarketcap.com/v1/ticker/?limit=0').then(function(resp){
if(resp){
$scope.moedas = resp.dat...
1
votes
0
answer
43
Views
Angularjs - connection with included model and filter
I have an issue with my included html. I've got main HTML, where I've got ng-repeat with filter like this:
And above this code, I've included filter html:
In this file I've got input with ng-model:
Include creates new child scope, but I don't exactly know how to fix it.
Have I change something in co...
1
votes
1
answer
74
Views
Angular Radio default select and ng-if button not working
i have ng-repeat inside images and icon two radio buttons but when the page loads the default checked based on the ng-if should have to show currently the ng-if not working.
HTML
Link 2
Choose an
IMAGE
ICON
ICONSSSSSSSSSSSSSSSS
IMAGES
JS
var app = angular.module('plunker', []);
app.cont...
1
votes
0
answer
96
Views
I'm not able to send the complete form data using ng-submit. Appended div data is being sent as undefined
I'm not able to send the complete form data using ng-submit.I'm able to send the data containing even name, event status, trigger event and relay state.
The data of the appended div is being sent as undefined.Thankyou
var app = angular.module('demo', []);
app.controller('ruleCtrl', ['$scope', '$htt...
1
votes
1
answer
76
Views
Use a scope variable inside .success and .error
I want to use a scope variable $scope.field.name when a request is done or failed. I tried to console it but it says undefined. How can I access a scope variable inside these syntax?
usiApp.controller('fieldController',['$scope','$window','$http','field','$timeout','Profile','Referrence',function ($...
1
votes
0
answer
96
Views
angular-ui-tree behaves strangely after updated list
I use the angular-ui-tree module for sorting a list, according to it's manual. Once an item is dropped, there's a list sent to the backend service, which saves the new sort order.
vm.treeOptions = {
dropped : function(e) {
restService.post('comments/' + currentId + '/settree', vm.myList);
}
};
{{ it...
0
votes
1
answer
64
Views
Bindings on directive with Isolate scope not in scope sometimes
So I have a directive with isolate scope and a controllerAs pattern.
var directive = {
restrict: 'E',
scope: {
something: '='
},
templateUrl: './App/directiveTemplate.html',
controller: directiveController,
controllerAs: 'vm',
bindToController: true
}
and in the controller I init with a call to a RE...
1
votes
1
answer
59
Views
AngularJS Variable inside scope or custom directive : related to ng-messages-include
I am learning AngularJS, came across one scenario and not sure what is the best approach.
Below is the scenario.
The html pages are running on a server https://example.com/com/server/ and can have appended url like /forms/resource/error.html or forms/src/main/abc.js
When I try to include like the be...
1
votes
1
answer
36
Views
How to use angularJs for dynamically created HTML(Which is not loaded to DOM)
Hello I am very new to AngularJs.
I am retrieving the HTML data from C# by calling ajax function. Here i am trying to use the AngularJs functionality for the dynamically generated HTML. But i am not able to see any AngularJs effect on this.But AngularJs effect is working fine for static HTML.Please...
1
votes
0
answer
101
Views
AngularJS multi screen validation on last step
I have an angularJS application. I have implemented a generic workflow using $routeProvider, templateUrl & Controllers.
Each step(screen) is verified when user click on next button and moves to the next step if validation passes. If validation fails user is required to fix all the error, displayed...
1
votes
0
answer
53
Views
$scope of abstract state controller is not being destroyed upon leaving - AngularJS
I have an abstract state app, a child state app.dashboard, and a login state login in ionic1 application. Each state has its template and controller, except for app state; it only has a controller, but no template.
User is directed to app.dashboard state from login state after successful login. User...
1
votes
0
answer
37
Views
How to manuplate path in JSON using AngularJS?
I want to create a new file inside a file. How can I achieve that?
Below I'm getting the files and their paths and I can access them
{{t.name}}
{{t.name}}
download {{t.name}}
I want to create a new folder in the path which I clicked. How can I do that ?
×
Create Folder
Create
Below is my controller...
1
votes
0
answer
160
Views
How can i use checkbox to select the multiple values, inside Select box in AngularJS?
I'm using ng-options to lad my values inside the select box. At the same time, I want to select multiple values. How can I do that using checkbox?
Note: multiple is not my option. I need it to be a dropdown
(function() {
angular.module('myApp', []).controller('test', ['$scope', function($scope) {...
1
votes
2
answer
14
Views
Multiple $http.get operatios and save the information in one $scope variable
I need to do four $http.get call and I need to send returned $scope variable to the one HTML to print all the information. In the moment I have the next code in JS:
(function (ng) {
var mod = ng.module('serviciosAdminModule');
mod.controller('serviciosAdminCtrl', ['$scope', '$http',
function ($scope...
1
votes
0
answer
39
Views
How to iterate through multiple dropdowns in a grid in AngularJS for selected value
How to iterate through multiple dropdowns in a grid in AngularJS for
selected value.Below is my code.Attached the sample grid UI .I wants to
iterate through each of the row values and form a array of objects.I have separate model for each dropdowns key and value pair.But not sure how to read those...
1
votes
0
answer
155
Views
Angular JS application CPU usage is more when idle
I have noticed my angular js application is taking more CPU usage about 45% when it is idle mode. We have built much complex application using angular js V1.6.0, angular material V1.1.5 and d3js V4 as we can see below
Earlier I have worked on the watcher count issues which was causing site to went i...
1
votes
0
answer
173
Views
AngularJS, How to call a function in component from Directive?
Thanks in advance, Basically in app component a timer which should be start when I call from a directive, Please let me know how I can call? I tried some method but didn't helpful. I'm new in angular js Please guide me.Thanks Here is the Js File code.
var app = angular.module('quizApp', []);
app.dir...
1
votes
1
answer
62
Views
Unable to set default value for angularjs select when using watch
View
departmentsList
departmentsList[0].departmentID = 1
departmentsList[0].name= 'Accounts'
departmentsList[1].departmentID = 2
departmentsList[1].name= 'Sales'
departmentsList[2].departmentID = 3
departmentsList[2].name= 'Service'
departmentsList[3].departmentID = 4
departmentsList[3].name= 'Manag...
1
votes
0
answer
51
Views
AngularJS: How to use html-decode for textarea to decode special characters
I am trying to decode special characters in the text area using html decode
Have defined this in the angularJS module
angular.module('app').filter('htmldecode', function(){
return function(encodedHtml) {
return angular.element('').html(encodedHtml).text();
};
How would I implement...
1
votes
1
answer
35
Views
Watch multiple attributes not working Angular js
I want to auto-populate date field based on the combination of two fields on my page.
The main page is Institution, in this main page I have a sub section for employees. I want to watch 2 fields in sub section, I tried this code but it is not working.
$scope.$watch(function () { return vm.institutio...
1
votes
0
answer
50
Views
Angular Guard is not able to access the Angular Service Object
I am trying to access the Angular Service Object (I have set the AuthContext in service) but Angular Guard is giving undefined even though that is well set.
I have login component, which I call first and internally It uses the Angular Auth Service.
In the constructor of that service, I ensure that A...
1
votes
1
answer
35
Views
How to pass scope value of directive into controller as $scope
I am using ng-camera directive for webcam access in my form
I am getting the image data uri in scope.snapshot i want to get this in my controller
controllers.js
.controller('visitorController', ($scope) => {
// webcam
$scope.picture = false;
});
directives.js
function directive($q, $timeout) {
retur...
1
votes
0
answer
35
Views
Angular 4 route monitor or URL change
Currently, I'm looking for a solution to monitor the changes in the route (URL).
Instance currently I have a flag which is set to false. When there is a change in the form/Page I will change the flag value to true. If the flag value is true I need to show an alert before changing the screen which is...
1
votes
0
answer
39
Views
How Angular's Scope is different from model?
How Angular's Scope is different from model?
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.name = 'myname';
});
Name is present in scope or model?
1
votes
0
answer
44
Views
Angularjs Confirmation Modal as Directive with action
I want to create angularjs directive mydialog wihc triggers the modal.Once the model is open I will have title and content,okcancel and confirm .Once the user click the confirm the corresponding action i.e. save should trigger .Here the save action is in MainCtrl .How to trigger that.
HTML Directive...
1
votes
1
answer
32
Views
Angularjs binding value from service
I wish to share a service value between one or more controllers (only one in the following example but that's not the point).
The problema is that the value hold in the service is not bound and shown in the view.
The code (derived from angularjs basic service example) is:
(function(angular) {
'use s...
0
votes
0
answer
12
Views
how to get number of days from angularjs
how to get number of days between two dates but its not working i think my date format not correct but how to change date format and get number of days
$scope.ChangeDate = function () {
var oneDay = 24 * 60 * 60 * 1000;
var firstDate = $scope.Current.PlainnedStart;
var secondDate = $scope.Current.Pl...
1
votes
0
answer
38
Views
How to stop infinitely calling AngularJS function from ng-if block?
A JS function is being called infinite times from HTML ng-if, and causing errors.
In my HTML, I have the line
which calls an angular function below:
$scope.isCanvasAndFeatureFlagOrStoreTagSet = (variant) => {
if (variant.productCategory.productGroup === 'CANVAS_PRINTS') {
const featureFlagName = 'M...
1
votes
1
answer
49
Views
Get data from JSON in angularJS
I am beginner in AngularJS and trying to get the data from .json file but I am not getting it at front side... anybody can tell me how can I find it on client side. Although I read this answer but couldn't find the desired result.
records.json
[
{
'firstName': 'Dawn',
'lastName' : 'Cassidy',
'gender...
1
votes
0
answer
30
Views
Trying to use enum in a template file, which doesnt belong to the component
If i want to leverage enums which exist outside the scope of my component.
export enum Template { Foo = 0, Bar = 1, Fuzz = 2 }
but when trying to leverage it my template file, it will throw an error.
for example. When serving the application, it does not understand what Template is. If I create a...
1
votes
3
answer
36
Views
$scope is not defined in script 2
Unable to fetch ng-change selected value from the dropdown.
I'm trying to pass the selected value from the dropdown to API call in script 2 as below, but unable to do so.
In the chrome developer tools it was showing error msg as '$scope is not defined' in the script 2( $scope.changedValue = function...
1
votes
2
answer
48
Views
Loop through JSON object within Angular
I have a loop for products, which is working perfectly.
£{{ result.price | number:2 }}
{{ result.name }}
Within the loop, there's an object which has JSON data.
{{result.colours}}
This contains the following:
[
{
'id':866337128495,
'title':'Product Title',
'handle':'product-url',
'image':'/img.jpg'...
1
votes
1
answer
33
Views
Load template attribute in AngularJS directive for $http.get
I am new using angularjs and I am trying to create directives. My query is, how can I change the URL of the $http.get from the html. This is my code:
HTML directive:
JS:
angular.module('testDirective', [])
.controller('testDir', function ($scope, $http) {
$scope.textoFalopa = 'Hola, es una prueba';...
1
votes
3
answer
54
Views
Angularjs when two way data binding is triggered?
In an AngularJS application I have a parent directive and a child directive.
parentDirective
angular
.module('myApp')
.directive('customForm', function(customService, apiV1, Constants, $timeout) {
return {
restrict: 'E',
scope: {
param1: '=',
param2: '=?',
boolean1: '@?'
},
template,
link: function(...