1

I have an attribute that is a function and I parse that attribute, but when I call the function, the function doesn't include any parameters.

// main ctrl
$scope.fn = function (attr) {
  console.log(attr);
};


// directive
$attrs.$observe('vFn', function (f) {
  $scope.fn = $parse(f);
});


$scope.fn($scope, {attribute: 'This is not passed'});
<div v-fn="fn()"

1 Answer 1

1

You have to pass the parameter in the directive call. Try this.

<div v-fn="fn(attribute)"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.