I have an angular directive for data insert. And now I want to use same angular directive for data edit/update, but my problem is, the input value is not shown in the input text field. My code is given below:
directive (js) :
dirApp.directive("inputDesign", function () {
return {
restrict: 'E',
transclude: true,
replace: true,
scope: {
inputName: '@',
inputNameText: "@",
inputValue: '@',
inputObject: '=',
checkInput: '&'
},
templateUrl: '../../template/_inputDesign.php'
};
});
template _inputDesign.php:
<div class="form-group">
<!-- {{inputObject[name]}} and {{inputValue}} value is not shown -->
<input type="text" value="{{inputObject[name]}}" class="form-control" ng-model="inputObject[name]" name="{{inputName}}" placeholder="Enter {{inputNameText}}">
</div>
html code ::
<input-design
input-name="a_gradeName"
input-name-text="Grade Name"
input-value="some value" // not work
input-object="gradeTbl.gradeName"
check-input="checkInput(gradeTbl.gradeName, gradeTbl.gradeName[name])">
</input-design>
js code ::
/* grade model */
$scope.gradeTbl = {
'gradeName': {
'name': 'a_gradeName',
'a_gradeName': 'some value',
'display': 'Grade Name',
'status': 'initial',
'regExpr': 'Alphanumeric'
}
};
$scope.gradeTbl.gradeName.a_gradeName = "this is test"; // not worked
$scope.gradeTbl.gradeName.name= "this is test x";