I want to have dynamic action attribute in the form. I have a code
Angular d
Here is my solution using Angular directives:
JS:
app.controller('formCtrl', ['$scope', function($scope) {
$scope.customAction = 'http://stackoverflow.com/';
}])
.directive('dynamicFormAction', function() {
return {
restrict: 'A',
scope: {
'dynamicFormAction': '='
},
link: function(scope, el, attrs) {
scope.$watch('dynamicFormAction', function (action) {
el[0].action = action;
});
}
};
});
HTML: