Angular Directive refresh on parameter change

后端 未结 5 1210
不思量自难忘°
不思量自难忘° 2020-12-04 13:08

I have an angular directive which is initialized like so:

         


        
5条回答
  •  臣服心动
    2020-12-04 13:45

    angular.module('app').directive('conversation', function() {
        return {
            restrict: 'E',
            link: function ($scope, $elm, $attr) {
                $scope.$watch("some_prop", function (newValue, oldValue) {
                      var typeId = $attr.type-id;
                      // Your logic.
                });
            }
        };
    }
    

提交回复
热议问题