Skip to main content

All Questions

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']; ...
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
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
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
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
2answers
55views

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 ...
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', ...
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: ...
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 ...
1vote
3answers
93views

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">...
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
1answer
38views

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 ...
0votes
2answers
70views

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('...

153050per page
close