Questions tagged [angular-directive-link]

21 questions
7
votes
1 answer

How to delay input validation in Angular 2+

In AngularJS, you could set a input with a directive to delay validation with link(scope, elem, attr, ngModel) { ngModel.$overrideModelOptions({ updateOn: 'default blur', debounce: { blur: 0, default:…
4
votes
2 answers

custom directive's link function is invoked before ng-repeat is replcaed

I have the following directive: .directive("picSwitcher", ["$timeout", function($timeout){ return { restrict: "A", scope: { pics: "=", fadeTime: "@", timeForPic:"@" }, template: '
3
votes
1 answer

Make angular directive link function as pre link?

I have a directive link function. By default angular link functions is a post link function, isn't it? How to make that as pre link? app.directive("textBoxCol", function () { return { require: "^grid", restrict: "E", …
2
votes
1 answer

How to assign values to isolated scope from ng-change method in controller?

Once user select value from dropdown i have ng-change function invoked onSizeChange and setting values of $scope.maxMb $scope.maxBytes $scope.FileSizeString, So my question how can i use these values in directive once value is selected from…
hussain
  • 6,587
  • 18
  • 79
  • 152
1
vote
2 answers

AngularJs directive - bind child element

Directive app.directive('mcAvatar', function() { return { restrict: 'E', scope: { width: '=width', src: '@src' }, templateUrl: 'directives/mc-avatar/mc-avatar.html', link: function…
jofftiquez
  • 7,548
  • 10
  • 67
  • 121
1
vote
2 answers

$compile not updating dynamically generated html runtime

Here is jsfiddle: https://jsfiddle.net/vikramkute/eq3zpmp9/5/ I am new to angular. I have an object which needs to be appended runtime in html. I am using angular 1.2.25 Expected output is 1 Quest 2 Quest 3 Quest but I am getting last value…
1
vote
0 answers

How can I avoid using angular directive link function, to use angular 1.5 component

I'm trying to migrate from Angular 1.4 to angular 1.5 components, then to typescript: I want to use Angular 1.5 component, like that her is my code it's incomplet, but this the idea, behind angular. module('cool.core'). component('hasAnyRole', { …
1
vote
2 answers

angularjs - scope property not yet available when calling link function

I'm writing a directive. This is the code i'm using: angular.module('weather', []).directive('myWeather', [ '$ionicSideMenuDelegate', function($ionicSideMenuDelegate) { var createWeatherConditionLabel, linkFunction; …
1
vote
0 answers

Directive link() querySelector

This it would be my directive I try to add click events in the link function for my directive when it initiates, but it gives me empty element when I try to get the elements. var link = function(scope, elem, attrs, controller){ …
0
votes
1 answer

How to disable the custom directive action on the first column of the table row?

I have a custom directive which opens the table row related data in a new window. When i click on the first column of the table row which is a checkbox selection, it is opening a new window, how should i avoid the custom directive actions on first…
0
votes
1 answer

Pass object to Angular directive's '&' parent scope function

How might one go about passing an object to Angular's (Angular 1.4.8) & ampersand scope binding directive? I understand from the docs that there is a key-destructuring of sorts that needs named params in the callback function, and the parent scope…
nrako
  • 2,952
  • 17
  • 30
0
votes
1 answer

Error when copy/paste zooming function into directive

I was trying to convert the GoJS space zooming simple javascript to an angular directive. Here is my Plunker When I try to copy/paste the zooming function into the directive it is throwing an error that says: "Error: Diagram.commandHandler value…
0
votes
1 answer

Replicating ng-if with a directive

So I have this directive which will allow use declaratively hide or show elements:
...
So our HTML becomes as declarative as possible. And this is what our directive looks…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
0
votes
1 answer

How to compile a directive which is loaded dynamically onclick event?

In my app.js I have $scope.onclick = function(){ // appending directve "exmDir" to body. document.body.setAttribute('exm-dir', ''); } The exm-dir is appending to body but it doesn't show its contents. How can I compile? Please…
Mr_Perfect
  • 8,254
  • 11
  • 35
  • 62
0
votes
1 answer

Declare AngularJS1 directive to uppercase text into existent element

I need to create a directive that uppercase all letter of content of a elem
Hello World!
with addition of all-uppercase
HELLO WORLD!
My mission is understending how Angular can provide an ability to manipulate…
1
2