Edit
How to set for this <input ng-model="this['newPlayer']['personal_info']['first_name']">
the ['newPlayer']['personal_info']['first_name'] dynamically from variable?
Something like this: <input ng-model="this[variable]">
You don't have to get it from the attributes just add this to your directive require: 'ngModel'
like this
app.directive("textInput", () => {
return {
templateUrl: "/text-input.html",
require: 'ngModel'
scope: true,
link: function($scope, $element, $attrs, ngModel) {
angular.element($element).append($scope[$attrs.myModel]);
}
}
});
and you have your different ngModel for each textInput instance in link function
$attrs and via the required key anyway - but how to assign the value to the ng-model?ngModel in your custom components: codelord.net/2017/07/28/youre-not-using-ng-model-enough
console.log($attrs.whatEverISent)and it will be results just okay. But how to send thewhatEverISentto the ng-model directive in the actual input tag?