angularjs - How to get Webshim's updatePolyfill called for elements added by an Angular "ng-if" -
i have angular app webshim added principally add date pickers in older browsers. i'm using this:
$scope.$on('$viewcontentloaded', function(target) { settimeout(function() { $('#partials').updatepolyfill(); }, 0); });
to dom updated when view changed.
but have several pages internally contain sections ng-if
used show fields if other fields in particular state, , sections not in dom when "$viewcontentloaded" happens polyfills not added. ng-if
logic driven model changes, ideal if there way generate "afterallmodelchanges" event above technique used irrespective of specific ng-if
logic present.
is there? or there better approach solving problem?
after few hours of googling , experimenting i've ended with. have in index page:
$.webshims.polyfill('es5 forms forms-ext');
and have added directive project:
eepdirectives.directive('input', function() { return { restrict: 'e', priority: -1, link: function(scope, element, attrs) { if (attrs.type == 'date') { // doesn't appear need settimeout when used $(element).updatepolyfill(); } } }; });
i'm interested in <input type="date" .../>
fields directive limited input
elements , further filters 1 type.
this gets polfill updated input field added dom, , works ng-if
has become true when views loaded.
Comments
Post a Comment