angularjs - Can't wrap directives angular 1.4.1 -


i'm trying wrap form creation in order put logic before running other directives, ui.mask , ui.bootstrap. haven't been able perform these other directives. html got transformed, not linked.

<div class="form-group" ng-repeat="field in headers.fields | filter: {editable: true}">       <label for="{{field.name}}" class="col-sm-4 control-label">{{field.label}}</label>       <div class="col-sm-7">         <input ng-show="field.autocomplete === false"                type="text"                fw-input                 id="{{field.name}}"                ng-model="data[field.name]" class="form-control" /> </div> </div> 

here how directive looks like:

fwinput.$inject = ['viacep', '$timeout', '$compile'];   function fwinput (viacep, $timeout, $compile) { return {   restrict: 'a',   //terminal: true,   // replace: true,   //priority: 1,   //scope: true,   //transclude: true,   //require: 'ngmodel',   link: {      pre: function prelink(scope, $el, attrs, controller) {        if (scope.field.customoptions.cep != undefined) {          // console.log(scope);           $el.blur(function() {            var $scope = angular.element(this).scope();            viacep.get(this.value).then(function(response){              var map = $scope.field.customoptions.cep;               $scope.$parent.detail_data[map.address] = response.logradouro;              $scope.$parent.detail_data[map.district] = response.bairro;              $scope.$parent.detail_data[map.city] = response.localidade;              $scope.$parent.detail_data[map.state] = response.uf;            });          });        }        else if (scope.field.customoptions.cpf != undefined) {          attrs.$set('ui-mask', "999.999.999-99");          attrs.$set('ng-cpf')           // $compile($el)(scope);           // $compile($el)(scope);          // ng-cpf ui-mask="999.999.999-99"        }        else if (scope.field.type == 'date') {          attrs.$set('my-datepicker');         }         console.log('link pre');      },      post: function postlink(scope, $el, attrs, controller) {      }   } }   } 

i have tried alternatives, compile, priority, terminal. when use compile, if $compile($el)(scope) gets on infinity loop, if use priority, somewhy ng-model not bind.

i tried achieve ng-attr-*, got trouble well.

is possible achieved? if not, there way bind directly, jquery?


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -