Posts

Showing posts with the label angularjs-directive

AngularJS scope return $$state

AngularJS scope return $$state I have a directive and in this directive I have a value that comes from my controller, here is my directive: angular .module('thermofluor') .directive('tablePlate', tablePlate) tablePlate.$inject = ['$timeout', '$q']; function tablePlate($timeout, $q) { var directive = { link: link, restrict: 'E', templateUrl: '/crims/thermofluor/experiments/table_plate.html', scope: { plate: '=' } }; return directive; function link(scope, element) { console.log("test"); var plate = scope.plate; console.log(plate); scope.letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']; scope.numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; experiments = ; experiments[scope.plate.experiment.well] = [scope.plate.experiment]; return; } } The problem is that when I console.log the scope I...

How to manage order of custom directives with separate directive controllers

How to manage order of custom directives with separate directive controllers In my html page I have call multiple directives. My directives has their controllers in separate files. My issue is all directive's init functions are not called in order. <div> <directive-a ng-if="a==true"></directive-a> <directive-b ng-if="b==true"></directive-b> <directive-c ng-if="c==true"></directive-c> <div> I have placed console.log and it printed a,c,b sometimes c,b,a. Kindly suggest me how to manage order. i have tried priority but it is not worked. Can we place directives link function in a separate file. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Invalid regular expression error in angular directive

Invalid regular expression error in angular directive Condition: Contents can only contain characters from the following set: a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 / - ? : ( ) . , ' + • Contents may NOT begin with ‘/’ • Contents may NOT contain ‘//’ export function directDebitValidator(nameRe: RegExp): ValidatorFn { return (control: AbstractControl): { [key: string]: any } | null => { const directDebitID = nameRe.test(control.value); return directDebitID ? { 'directDebit': { value: control.value } } : null; }; } @Directive({ selector: '[directDebit]', providers: [{ provide: NG_VALIDATORS, useExisting: DirectDebitValidatorDirective, multi: true }] }) export class DirectDebitValidatorDirective { validate(control: AbstractControl): { [key: string]: any } | null { return control.value ? di...