new

Stack Overflow for Teams

A private, secure home for your team's questions and answers.

Learn more
0
votes
1answer
30 views

AngularJS scope issue with $http

Continuing my adventures with AngularJS, I have what I believe is a scope issue, but not entirely sure. In my controller I'm building two test array's for demo purposes, search.filterDemo and search....
0
votes
0answers
37 views

Access parent scope variables in Angular directive [duplicate]

I have a dynamic form using schema form (http://schemaform.io/) - I need to include some buttons to edit or delete each control in the form, so I built this directive that finds all form controls and ...
0
votes
2answers
40 views

How to access child scope?

In the below code, I'm trying to get a console log in the Directive (child scope),I need to get scope details.I tried adding a scope variable to the function in the directive also, but didn't work. ...
0
votes
1answer
99 views

Angular directive scope not accessible in parent controller

I am working on a angular applicaiton I stucked in a issue regarding calling direcive method into parent controller . Problem is i am using login directive on profile controller . I want to call ...
0
votes
1answer
168 views

Angular Bootstrap DateTimePicker - How to force a user to select from dropdown by disabling the inputs for that field

right now from my code, I am able to select a date & time from the drop-down and able to edit by taking inputs from the user. But I want to force the user to select only from the dropdown rather ...
1
vote
1answer
100 views

Access controller function from directive

I have a main controller: MainCtrl and a function within it: $scope.ctrlFn This function expects an argument and returns a string concatenated to the received argument value. MainCtrl JS: app....
0
votes
0answers
22 views

Access directive scope variables within directive method when invoked by view

I am trying to access directive variables within directive method when the method is called by a button in the view Directive Method scope.getData = function () { StaffingToolSvc....
3
votes
3answers
254 views

Isolated scope binding types

According to AngularJS Developer Guide - Directives "Isolating the Scope of a Directive", scope binding can be done in 3 types =, @ and & and according to "Directive Definition Object" ...
1
vote
1answer
130 views

Angular directive 1 way binding is working but 2 way binding is not

I am not using scope in my controller as i use controller as etc.. I have proof of concept that plunker without scope is working 1 way binding is working 2 way binding is NOT working - shows ...
1
vote
4answers
80 views

If my Angular Controller is not using any $scope, then how do i do 2 way data binding in my directive

I have been using Angular without $scope Controller: angular .module('app') .controller('requestController', requestController); requestController.$inject = ['$location','requestService']; ...
0
votes
2answers
41 views

Angular Directive incoming scope value is undefined

In html I have this object passed into directive <lcd-code ldcCode="{{ detail.program.ldcCode }}"></lcd-code> detail.program.ldcCode = "PSIH" ... However in the Directive it is ...
0
votes
0answers
176 views

Angular Directive with ng-include to html templateUrl not showing error messages

If I put this html/angular/css code in line and click on Submit Request Button it highlights in red and shows the error message properly <div class="col-md-12" style="margin-top: 5px;"> &...
0
votes
1answer
729 views

Angular 1.5 component inside ng-repeat, template function run just once

I tried to use angular component replacing directive for creating component (a data table). I want to use the component inside of ng-repeat like: <div ng-repeat='item in items'> <my-...
0
votes
0answers
40 views

AngularJS - why my scope variable is not refreshed when $on is called?

In my main app controller, I'm calling this async method which is broadcasting an event when done (loadData). In the event handler i'm loading some data to my $scope.layers array. But nothing is shown ...
0
votes
2answers
123 views

How to compile Angularjs nested directive with javascript

I have a nested directive that has nested hierarchy. angular.module("app", []); angular.module("app").directive("hero", function () { return { restrict: "E", template: "<div>Hero {{...
0
votes
1answer
129 views

Error: [$compile:multidir] when using multiple directives on same element

I made a form for credit cards payment which contain many validations, on the input below I try to validate 2 settings, one is the card type (visa,diners,amex, etc...) and the second validate is for ...
1
vote
1answer
98 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
0answers
153 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: ...
0
votes
1answer
305 views

how to fill empty array with objects updated in directive?

I started my adventure with Angular directives. Somewhere in my app I have to choose number of passengers. Then I have to assign "First Name" and "Last Name" for each of them. So I created simple ...
1
vote
1answer
628 views

How to change all directive scope value from any one of directive?

I have a directive which was repeatedly n times. I have click event action in every directive. Whenever I click, on click function, It change some scope variable names which defined in directive. But ...
0
votes
1answer
243 views

Retrieving model values from dynamically opened controller's scope in AngularJS

I am developing an Web Application using Angular JS. I am a beginner to AngularJS. In my app, I need to dynamically add and remove elements. I use directive for it. Adding and removing elements is ...
2
votes
1answer
624 views

How to use custom directive on Input fields in Angular 1.x?

I'm trying to modify the input element using a custom AngularJS directive. Basically I want to replace any <input type="country"> fields with a country drop-down. But the directive doesn't seem ...
0
votes
0answers
923 views

How to make a custom ngIf directive without scope isolation

I want to use ngIf directive and to make my custom myOwnIf directive without scope isolation. As you can see in the code here - it doesn't work for me without scope isolation. Can someone assist in ...
2
votes
2answers
70 views

Update directive's templateurl's content binding on scope's property change

So what I am basically trying to do is make a reusable component in angularjs using directive. This directive will be a different app module(say 'childApp'). I am injecting this module and its ...
0
votes
0answers
32 views

Directive scope not removed when it was closed in angularjs

I have a directive like below : angular.module('autoKeywords', []).directive('autosuggest',function(keywordService, $timeout) { return { restrict: 'A', replace: false, transclude: true, ...
0
votes
2answers
47 views

Call method in controller from directive

HTML : <div id="idOfDiv" ng-show="ngShowName"> Hello </div> I would like to call the function which is declared in my controller from my directive. How can I do this? I don't receive ...
3
votes
1answer
382 views

ng-repeat within directive will not update when adding or modifying objects to the existing collection

I've got a treeview which contains objects with nested arrays that I am trying to populate. A working plunker may be found here. Here is a breakdown of how the code is structured and what I have ...
1
vote
3answers
1k views

ng repeat with custom directive

I am trying to read properties set on an element by ng-repeat using another custom element: <div foo ng-repeat="img in [{image: 'images/img1.jpg', text: 'some text'},{image: 'images/img2.jpg', ...
0
votes
2answers
952 views

angularjs - use directive to change parent scope

I'm trying to change a parent scope property from within a directive. This is the structure of this section of my project (It may help to understand what's going on): -details --overview.html --edit....
3
votes
1answer
451 views

Use directive with required ^form in an angular-material md-dialog

Plunker available here I want to include a directive (first directive in the example) with a required ^form in an angular-material md-dialog. When the dialog is shown, there's an error saying the ...
0
votes
1answer
76 views

Custom angular directive controller not updating

I created my own angular directive which can simply be used as: <basket-summary></basket-summary> This element is used on my master template page (the index.html). The directive is as ...
2
votes
2answers
832 views

Do I need to destroy local controller variables when directive is destroyed?

I've been writing lots of Angular directives recently and have been reading about having to manually remove things you create in a directive when it is destroyed. It's still a little unclear though. ...
0
votes
1answer
298 views

$apply in angularJs not updating my scope variables

I am building an angular ionic app using meteor framework so far so good, but I am trying to update my scope using $apply method which is not updating my scope, here is my code. To be more specific ...
0
votes
3answers
61 views

Angular.js: custom directive

I am trying to add custom directive in my app. But it is not getting called on button click event. my controller- appServices.directive('customClick', function() { return { restrict: 'E', ...
1
vote
3answers
86 views

Modify ng-show within directive template from link

I have a directive element: return { restrict: 'E', replace: true, transclude: true, template: '<ul>' + '<li ng-show="hideItem">...
0
votes
1answer
198 views

Add Directive Attribute to Directive Element

I have a directive element: return { restrict: 'E', replace: true, transclude: true, template: '<ul>' + '<li {{myNewAttrDirective}}&...
2
votes
1answer
443 views

Directive inside templateUrl of another directive and passing attribute

I'm having two directives and I'm trying to call one directive inside another directive's templateUrl with some attribute but I'm not able to get the compiled attribute value in the second directive. ...
2
votes
1answer
313 views

AngularJS: Access value of data binding from within directive

I am trying to access the value a data binding inside a directive executed after an ng-repeat. Here is my html: <div ng-repeat="(version, data) in versions" rszvers> <div class="...
0
votes
1answer
125 views

Why variable defined in the directive controller not working?

Why i defined 'sayHi' in the controller, and it does not display in the template? js: (function(){ var app = angular.module('myApp', []); app.directive("directive1", function(){ return { ...
0
votes
2answers
37 views

What to use to set styling dynamically in Angular?

I started working with angular and creating my "little" project. I came up to templating issue. Basically, I try to set colour for elements dynamically with angular. I can't figure out what would be ...
0
votes
1answer
36 views

Strange behaviour when adding directive dynamically in ngrepeat

I am trying to add a directive dynamically inside ngrepeat. Please refer to the following fiddle link: Fiddle Link Code: // Code goes here var app = angular.module('myApp',[]); // myDir Directive ...
1
vote
1answer
2k views

Access isolated scope in angular directive template

I am currently writing an angular directive that uses a template in a different HTML file and an isolated template. The directive gets some string via @ to its scope and that value is available in teh ...
10
votes
9answers
2k views

How does one pass an argument to a directive without over-writing parent scope?

I need to create a directive that acts upon table cells where the table rows are rendered using ng-repeat -- to that end I have relied in part on this answer to a question entitled "Calling a function ...
0
votes
2answers
694 views

setting scope to null blocks 2 way binding angular directive

I have created a directive and I believe that two-way bind is being broken when I set a bound scope variable (textStyleOriginal) to null. What is a good way to resolve this issue? .directive('...
0
votes
2answers
60 views

Can anyone explain the core concept of model in angularjs?

HTML Code: <mydirective></mydirective> <input type="button" ng-click="showText()" value="Show Service Text" /> Js Code: var app = angular.module('demo', []); app.service(...
1
vote
2answers
767 views

AngularJS getting data from controller to directive

I am trying do display data retrieved from database in controller to directive. I am using Controller as syntax, but when i try to display my data in directive it is undefined. I am getting right ...
2
votes
1answer
525 views

AngularJS - Using a comma or other special character in expression to watch with $scope.$watch

I have a directive that was written a while ago and has been used throughout my application. I have now realised that it needs a watch so it can refresh and update when the value changes. This is an ...
1
vote
1answer
120 views

Directive hierarchy & bindToController

I encountered an issue while writing an AngularJS directive. I'm actually trying to melt two principles, directive inheritance and using the controller object (the famous this) instead of $scope. I ...
3
votes
1answer
5k 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
63 views

What is the order of multiple directives execution?

Let's say I want to create a new directive with an isolated scope that interacts with the input element, which already has ng-model. How can I be sure if ng-model will bind to right scope. <input ...