All Questions
23 questions
16votes
1answer
14kviews
Adding Multiple 'require' Options for Angular Directive
Usually in Directives, I use require: 'ngModel' if I want to pass the scope to it. This works fine. But I am now creating a directive that creates 5 different HTML elements each with different ...
2votes
1answer
2kviews
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 ...
1vote
3answers
2kviews
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', ...
3votes
1answer
706views
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. ...
0votes
1answer
507views
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 ...
1vote
2answers
1kviews
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 ...
1vote
1answer
456views
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 ...
0votes
2answers
3kviews
Radio button returning the previous value in ngchange
I am trying to create a directive for a radio input with values. These values will be passed from a directive. I also want to update a value in the controller when the radio button is changed. Here is ...
0votes
1answer
568views
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 ...
0votes
4answers
92views
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']; ...
0votes
2answers
1kviews
What's the use of the "attrs" parameter in an angular directive link function
Considering this directive : .directive('myDirective', function(httpRequestTracker) { return { restrict: 'EA', scope: { myvar: "=", }, link: ...
1vote
2answers
525views
Use a directive to display data from scope
I'm trying to understand how directives are working but I'm running into a bug pretty soon. I've created a codepen of my example here I've created a scope called movies which has 3 movies in it. I ...
0votes
1answer
392views
Add Directive Attribute to Directive Element
I have a directive element: return { restrict: 'E', replace: true, transclude: true, template: '<ul>' + '<li {{myNewAttrDirective}}&...
0votes
2answers
213views
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 {{...
0votes
0answers
411views
I want to call custom directive on button click and passing attributes as a parameters
This is html code <button type="submit" ng-click="get(selected_items)">Genrate</button> <pre>selected roles = {{selected_items}}</pre> <grid table-data="data" cols="...