-3
votes
0answers
21 views

directive element click update from controller

I have link function in my directive which has following structure inside it: $(element).click(function(){ if(){} else{} }) Now i have an event in the controller which should update the ...
0
votes
0answers
31 views

Angular 1 component save current input values when clicking outside the input or other inputs

i am using angular material and have a modal that pops up with places where you can edit data, this inline editing area is created using a components. When user click the values, these values become ...
1
vote
1answer
61 views

AngularJS - href redirect to same domain cause page display before data are ready

I'm using Angular 1.4.1. I made a directive, a generic card with thumbnail and a link. The link is a generic absolute url, but usually lead to somewhere inside the app. So assuming I am in http://...
0
votes
0answers
37 views

Angular JS - The directive is accessible between controllers

I am new to Angular and just wondering how come my directive is accessible between controller as I only register it into sub controller, not main app controller. Below is my code. app.module.js ...
0
votes
0answers
67 views

Angular.js + ui-router wrong controller

I'm using angular 1.6.1 and angular-ui-router 0.3.2. I have basic routes set-up as follow: { state: 'home', config: { url: '/home', templateUrl: '...', title: 'home' } }, { state:...
0
votes
2answers
43 views

Why do I need a $watch when using function in controller in combination with a directive

I know and can imagine why I need the commented lines of code to let this work. But I can't found the technical reason. Why is the field not update when you click on the button? (the $watch fixed the ...
1
vote
2answers
32 views

Angular: updating view with value passed from directive to controller

Budding web developer here struggling with updating the view from my controller. I'm using highmaps and angular to build a neat selection tool for my web app. I've got a directive nested inside the ...
0
votes
2answers
44 views

Data share between directive and controller in AngularJS

I need to take a step back and understand the data flow between controllers to directive, directive to controller and the inline template vs template url in directives. I have customDirective ...
0
votes
2answers
34 views

Angularjs 1.x controller not responding in directive

So I am trying to separate my menu into a directive. I have a very simple controller: function Menu(){ self = this; self.tab = ''; self.selectedTab = function(tab){ self.tab=tab; ...
0
votes
0answers
13 views

Share function between controllers with angularjs [duplicate]

I start with angularjs. I would like sharing function between 2 controllers because I want use same datas (json) in differents controllers. I tried to add directive.. app.controller("PostsCtrl", ...
2
votes
2answers
99 views

Angularjs Modules - Packaging Directives and Their Controllers

I have the following javascript code and i ran into a issue: My .js file angular.module('MyApp',['ngMaterial','ngMessages']) .controller('MainCtrl',['$mdDialog',function($mdDialog'){ this.openDialog ...
0
votes
3answers
62 views

AngularJS, calculation addition (+) is not working

I tried to calculate $scope values through angular controller. For instance: the below code works in order to multiply values inside brackets. However, addition(+) is working like 400+200 = 400200. ...
0
votes
3answers
270 views

How to add a progress bar in ionic app

I really need your help, I am new to ionic project. Currently working on a project. This app pulls blog post from wordpress using $http. How can I add a progress bar to tell the users that the page is ...
1
vote
1answer
81 views

AngularJS isolate directive - data not binding in .controller (but works in .link)

A custom directive was created in AngulerJS 1. It has in isolate scope, and is data-aware (gets data from server API). Its definition looks like this: var dirJobView = function ($location, ...
0
votes
2answers
236 views

use jQuery.matchHeight from Angular directive

I am trying to set elements to the same height using jQuery.matchHeight. I call the function from an Angular directive angular.module('myApp') .directive('matchHeight', ['$timeout', function ($...
0
votes
2answers
36 views

Cannot declare controller in Angular Js

I am developing an Web Application. In my application, I am using Angular JS. Frankly, I am new to Angular JS. But now I am having a problem my declaring controller. Please see my code below. <...
0
votes
1answer
76 views

Retrieving model values from dynamically opened controller's scope in Angular js

I am developing an Web Application using Angular JS. Frankly, I am newbie to Angular JS. Very new. In my app, I need to dynamically add and remove elements. I use directive for it. Adding and removing ...
0
votes
2answers
66 views

Controller data not passed to directive

I started looking into angular and cannot seem to figure out why my data is not passed to my directive. I have code here: https://plnkr.co/edit/ONwYevQ4NbvBVjTwARHl?p=preview My Code: app.js: var ...
0
votes
1answer
33 views

Anguarjs Directive or Controller to seperate views components

I'm trying to learn Angularjs (1.5) I have already understood the concept of filters and services and I've also understood logic behind controllers and directives too. But when I started to write my ...
0
votes
2answers
1k views

angularjs controller access directive scope value

I have this controller with directive inside my html code. The directive have scope value I would like access from the parent controller and show in the html. Hope my example code give you a simple ...
3
votes
1answer
159 views

scope issue with ng-view, parent controller, custom directive

I'm so confused about my situation. Let me briefly introduce my situation. HTML structure. (It's just structure, full HTML is more than that but there is no any other controller except "...
0
votes
0answers
112 views

Why isn't my AngularJS view updating?

(Update: still haven't solved this.) (Further update: I've had no further responses from anyone. Surely this must be solvable?) I'm combining Angular and D3, which I think is causing some problems. ...
1
vote
1answer
532 views

Getting error when pass data between controllers using sample service

as part of angular js learning, i created small app that will pass the data between two controllers using services..below is my code to pass the data between two controllers.. Controller code <!...
0
votes
1answer
63 views

Passing a directive to directive via an object in angularjs

Lets say there are 2 directive components 1) List 2) Profile "List" should accept the data in the form of Object notation passed to it through the controller and display the HTML or Directive ...
0
votes
3answers
112 views

how angular directive bind controller's service data

controller: service.checkSub(function(data){ $scope.showSub = data.subscribe? false : true; }) directive: app.directive('showSub', function() { return { restrict: 'E', ...
0
votes
0answers
43 views

Change element style before and after BootstrapModal action

I'm new in Angular and I want to know that is there a possibility to change <div> style using directive. Here is the function that is in controller: $scope.importData = function () { ...
1
vote
1answer
122 views

Where should I place code to be used across components/controllers for an AngularJS app?

Should it be associated with the app module? Should it be a component or just a controller? Basically what I am trying to achieve is a common layout across all pages within which I can place or remove ...
3
votes
2answers
227 views

Refresh the data in controller when scope gets changed in AngularJS

I'm pretty new with angular and I've read a lot of threads here and googled this topic but I cannot get a clear answer. what i am really trying to achieve is. lets suppose I have a controller A, this ...
0
votes
3answers
538 views

call function in controller from template.html

I am new to AngularJS, Somehow while going through many sites now I am able to create a directive for showing some data.Now I need to send some data to controller by clicking the button. I need to ...
-1
votes
2answers
127 views

Setting the value of ng-click directive based on the variable assigned to it

I'm using angularJS to make a SAP. The problem I am having is within one of my template files. I want to set the value of ng-click directive using a variable declared in that controller. Based on the ...
1
vote
1answer
67 views

Custom validation as a function in Angular

In Angular, I am trying to validate a value of a field on blur. I have a list of customers, and I want to check if the model value in the field is in my list of customers. If not, I want to set the ...
0
votes
2answers
350 views

Use controllers to: Manipulate DOM

I have a ng-repeat-end-watch directive ..... return { restrict: 'A', link: function (scope, element, attr) { if (scope.$last === true) { scope.$evalAsync(...
2
votes
1answer
73 views

How do call function with parameters from controller into view and how to bind that function to directive in angularjs

The problem is stated in the title. I have the following code. JavaScript: app.controller("myCtrl", function($scope) { //this is my controller $scope.type = "type"; ...
0
votes
2answers
110 views

How to put multiple HighChart in a page having different series value in different chart

app.controller("myCtrl", function($scope) { $scope.perspectives = [{ title : 'Depression Remission at 12 Months CMS159v4', graphData: [34,2,5,5,2,1,10] }, { title : '...
0
votes
1answer
30 views

How to keep different files for controller and directive which is using that controller

I want to understand if there is any way that I can keep controller and directive which is using this controller in different files? I have two files, say 1. MyController.js and 2. MyDirective.js. ...
1
vote
1answer
210 views

Angular $watch not working on controller variable updated by directive

I am trying to place a watch on controller variable which gets updated from a directive using function mapping. variable is getting updated and logged in console but watch on it not working. Code ...
0
votes
2answers
303 views

directive isolate scope data undefined in controller

I have been writing down a module for image gallery, I have got a issue with it, my isolate scope is becoming undefined and does not change its state. I cannot understand the reason for it. I have ...
1
vote
1answer
206 views

Angular directive binding without template controllerAs

I'm encoutering an issue when using a custom directive without template (use Server generated DOM) and binding my view to a controller. Here is my jsFiddle sample : angular.module('myModule', [...
0
votes
0answers
31 views

Why doesn't this angular code / directive seem to be executing?

None of the links are broken. None of the Javascript between the two console.log's seem to be executing. I've been trying to work this out for a while but don't see anything wrong. Any clue ...
0
votes
2answers
164 views

How do I call a controller method from my directive?

How do I call a controller method onDrag() from my directive? Html / (SVG) <g ng-controller="EntityController as vm" draggable> ... </g> Directive app.directive('draggable', ['$...
1
vote
2answers
498 views

Update Directive Scope After Controller Service Call

I have a controller, which calls a service that performs a $http.get app.controller('myController', function ($scope, mService) { $scope.chair; myService.getData().then(function (data) { ...
0
votes
1answer
238 views

AngularJS: Image upload + FileReader preview. Trouble binding between controller, directive and scope

I'm relatively new to Angular and are stilling trying to wrap my head around all it's magic and scoping. I'm trying to do a simple image upload with preview script and I'm missing the final piece. I ...
1
vote
1answer
402 views

Can one inject a directive $compiler into a service?

I'm trying to output a directive as a javascript string so that I can place the html in a code display window. I'm interested in the actual code rather than the browser rendered version because I'm ...
4
votes
1answer
2k views

Angular Component: how to specified value for output binding function defined in parent?

I wanted to use Angular 1.5's component to get benefit from its one-way binding: <hero-detail hero="ctrl.hero" save="ctrl.save(hero)"></hero-detail>. But, as Todd Motto points on his blog: ...
0
votes
0answers
19 views

How should a controller be specified in a directive?

Assume we have these 2 snippets, what's the difference between controller: function (...) { } and controller: 'myController' app.directive('testDirective', function () { return { restrict: '...
1
vote
1answer
261 views

angular directive controlleras and link

I have markup like this <i class="fa-font icon-user" wd-user-profile></i> to show / hide this div <div id="user-profile" ng-show="vm.isVisible"> <h3>user name</h3> ...
0
votes
0answers
45 views

Organizing a composite angular js directive

As part of creating a complex grid control, I've been writing a directive which builds this composite control that uses multiple controls within. The master control consists of a core grid control, a ...
1
vote
1answer
145 views

Angular Unit Testing: Isolate certain components defined on module

I've inherited a large AngularJS project using Karma and Jasmine and am trying to follow the conventions that were set out before me, but am having trouble unit testing directive/controller modules. ...
0
votes
1answer
71 views

Angular JS : How do I Lazy load my directive?

my html structure is like below main.html <div class="row"> <div class="col-xs-9" id="myResultPage"> <!-- Code for service call to get the results ...
0
votes
2answers
39 views

Select with multiple columns in AngularJS not working properly?

Demo link Hi all, I created a sample for select with multiple columns in AngularJS. which is working fine if I pass the value directly like this: $scope.rowDatas = [ { ID: "09-...