app.directive('formInput', function(translations){ return { restrict: 'E', transclude: true, replace: true, template: '<input class="form-control" ng-model=vm.user**[formGroup.attribute]**></input>', require: [ '^formFor', '^formGroup' ], link: function($scope, $element, $attrs, $ctrls) { var formForCtrl = $ctrls[0]; var formGroupCtrl = $ctrls[1]; $attrs.$set('id', formGroupCtrl.inputId(formForCtrl.name)); $attrs.$set('placeholder', translations.User[formGroupCtrl.attribute]); } } });
namely, in the line ng-model=vm.user.
+ formGroup.attribute