0 Replies Latest reply on Mar 5, 2014 11:27 PM by oddgames

    Has anyone had trouble with ng-model updating in a photoshop extension?

    oddgames

      For some reason I can't get my ng-model to work unless I use CTRL+V or the delete key. I had to add this code to fix it:

       

      Anyone else had this issue>?

       

       

      (function () {

          'use strict';

       

          var blur = angular.module('ngModelUpdate', []);

       

          var directive = ['$parse', function ($parse) {

              return {

                  restrict: 'E',

                  require: '?ngModel',

                  link: function (scope, elm, attr, ngModel) {

                      var model;

                      if (!ngModel) {

                          return;

                      }

                      elm.on('input keydown change', function () {

                          scope.$apply(function () {

       

       

                              ngModel.$setViewValue(elm.val());

       

       

                          });

                      });

       

       

                  }

              };

          }];

       

          blur.directive('input', directive);

          blur.directive('textarea', directive);

       

      })();