Questions tagged [directive]

A concept of 'command' used by many programming languages and frameworks. Use this tag with a language and/or framework to indicate context. The C/C++ pre-processor is one language that relies heavily on directives. They call it "pragmas".

2065 questions
12
votes
4 answers

Pass parameters from directive to callback

I'm trying to define a directive sortable which wraps jqueryui's sortable plugin. The angular code is: module.directive('sortable', function () { return function (scope, element, attrs) { var startIndex, endIndex; …
Freewind
  • 193,756
  • 157
  • 432
  • 708
11
votes
1 answer

Is it possible to upgrade angularjs atttribute directives to use in angular 4?

I've been able to upgrade an angularjs element directive to be used in angular 4. Here's a sample code: [myScores.js] angular.module('app.components.directives.myScores', []) .directive('myScores', function() { return { scope: { score:…
Will
  • 1,718
  • 3
  • 15
  • 23
11
votes
1 answer

What's the difference between the .asciz and the .string assembler directives?

I know that the .ascii directive doesn't put a null character at the end of the string, as the .asciz directive is used for that purpose. However, I don't know whether the .string directive puts a null character at the end of the string. If it does…
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
11
votes
1 answer

angular directive handles http request

I have angular directive that accept url to obtain remote data: ... Directive itself: app.directive('myTag', ['$http', function($http) { return { restrict: 'E', transclude: true, replace: true, …
Dewfy
  • 23,277
  • 13
  • 73
  • 121
11
votes
2 answers

Getter & setter support with ng-model in AngularJs

I am trying to get getter/setter support for ng-model by implementing a directive that will take care of getting and setting the values to/from the view/model. I am almost there, but I end up in infinite $digest loops. The idea is to set…
sboisse
  • 4,860
  • 3
  • 37
  • 48
11
votes
1 answer

Conditional outer tag in a directive (i.e. )

I like a directive that conditionally puts a tag outside some content (but always prints the content), like this:

{{model.text}}/p> so if condition is true I get

yada…

joeriks
  • 3,382
  • 8
  • 32
  • 42
11
votes
2 answers

Using ng-hide or ng-show on select box option

Is it possible to hide select box options using the ng-hide directive? http://jsfiddle.net/cr4UB/