angular 指令中未显示 ng-model 值

ng-model value are not shown in angular directive

我有一个用于数据插入的 angular 指令。现在我想对数据 edit/update 使用相同的 angular 指令,但我的问题是,输入值未显示在输入文本字段中。我的代码如下:

指令(js):

  dirApp.directive("inputDesign", function () {
    return {
       restrict: 'E',
       transclude: true,
       replace: true,
       scope: {
          inputName: '@',
          inputNameText: "@",
          inputValue: '@',
          inputObject: '=',
          checkInput: '&'
       },
       templateUrl: '../../template/_inputDesign.php'       
    };
});

模板_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代码::

  <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 代码::

/* 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";

我最好的猜测是这与这个位有关:

scope: { inputName: '@', inputNameText: "@", inputValue: '@', inputObject: '=', checkInput: '&' },

我会尝试将 inputValue 更改为

inputValue: '=',

这里是另一个关于 = 和 @ 在范围上的区别的回答。

What is the difference between '@' and '=' in directive scope in AngularJS?

在您的 _inputDesign.php 中,将值和 ng-model 从 {{inputObject[name]}} 更改为 inputObject.name