AngularJS directive - true/false template loading
Angular.js comes with several built-in validation mechanism for input fields (ngRequired, ngPattern etc.), however, by using this directive it's possible to handle both validation outcome (true or false) by specifying a custom template for each of results (or just for one of them). The tf-template directive makes it easy to use any variable(s) defined in scope as a validator variable(s). A validator variable will trigger directive's validation process every time the variable(s) changes.
You can test 'tf-template' here.
- AngularJS
You can get it from Bower
bower install git://github.com/UstymUkhman/tf-template.git
Load the script files in your application:
<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="bower_components/tf-template/source/tf-template.min.js"></script>
Add the specific module to your dependencies:
angular.module('myApp', ['tf.template', ...])
You can just download this repository:
git clone https://github.com/UstymUkhman/tf-template.git
Use the script file in your application:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script type="text/javascript" src="./src/tf-template.min.js"></script>
And add the module to your dependencies:
angular.module('myApp', ['tf.template', ...])