JavaScript AngularJS custom directive with input element, pass validator from outside angularjs custom directive input validation,angularjs custom directive input,angularjs

I'm using a simple custom directive for a modified input field which occurs throughout my application:

app.directive('editor', function() {
    return {
        restrict: 'E',
        templateUrl: 'editor.html',
        scope: { value: '=' }
    };
});

The editor.html basically creates an input element with additional controls. Simplified it looks like this:

<div>
    <input ng-model="value">
    <!-- more code here -->
</div>

I access my directive using <editor value="{{object.name}}"></editor>. This works perfect. Now I need to perform different validations on the input. The necessary validators to use vary, so I would like to be able to pass the actual validators to my directive. Something like:

<editor value="{{object.name}}" validator-a validator-b></editor>

or

<editor value="{{object.name}}" validators="validatorA,validatorB"></editor>

How could I achieve that?

Answer:1

I want to know if its possible to have tooltip on a collapse anchor tag. The code which is use for collapse is: <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">Data</...

I want to know if its possible to have tooltip on a collapse anchor tag. The code which is use for collapse is: <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">Data</...

Background: I am compiling 2 dependent TypeScript files to js, which produces also source maps (one source map per file) using tsc 1.0 I'm using -m commonjs and then use browserify to generate a ...

Background: I am compiling 2 dependent TypeScript files to js, which produces also source maps (one source map per file) using tsc 1.0 I'm using -m commonjs and then use browserify to generate a ...

So, What I'm trying to do is fairly simple with vanilla JS, but I'm using AngularJS and I would like to know how to do it the best way within the framework. I want to update the selected options in a ...

So, What I'm trying to do is fairly simple with vanilla JS, but I'm using AngularJS and I would like to know how to do it the best way within the framework. I want to update the selected options in a ...

  1. angularjs select multiple options
  2. angularjs select multiple ng-options

I have an array of objects (specifically easelJS images) - something like this: var imageArray = new Array; gShape = new createjs.Shape(); // shape is something imageArray.push(gShape); What I want ...

I have an array of objects (specifically easelJS images) - something like this: var imageArray = new Array; gShape = new createjs.Shape(); // shape is something imageArray.push(gShape); What I want ...