'use strict';
angular.module('arethusa.core').directive('pluginSetting', [
  'userPreferences',
  function (userPreferences) {
    return {
      restrict: 'A',
      scope: true,
      link: function(scope, element, attrs) {
        scope.change = function() {
          var model = scope.setting.model;
          var value = scope.plugin[model];
          var change = scope.plugin[scope.setting.change];
          userPreferences.set(scope.plugin.name, model, value);
          if (change) change();
        };
      },
      templateUrl: 'templates/arethusa.core/plugin_setting.html'
    };
  }
]);


'use strict';
angular.module('arethusa.core').directive('pluginSetting', [
  'userPreferences',
  function (userPreferences) {
    return {
      restrict: 'A',
      scope: true,
      link: function(scope, element, attrs) {
        scope.change = function() {
          var model = scope.setting.model;
          var value = scope.plugin[model];
          var change = scope.setting.change;
          userPreferences.set(scope.plugin.name, model, value);
          if (angular.isFunction(change)) change();
        };
      },
      templateUrl: 'templates/arethusa.core/plugin_setting.html'
    };
  }
]);


Fix calling of change function
pluginSetting: Fix calling of change function

A function itself is passed to this - not a pointer to a public plugin
function.

Fixes e.g. the bug that the `Preselect` setting in `morph` didn't
trigger when you clicked on it.
