1

On the code you can see as follows:

<div class="form-group form-group-sm" ng-repeat="sForm in sForms">
    <label class="col-sm-3 control-label">{{sForm.label}}</label>
    <div class="col-sm-8">
        <input type="text" class="form-control" placeholder="{{sForm.place}}" name="{{sForm.name}}" ng-model="search[sForm.propertyName]" ng-click="searchDisabled(sForm.val)" ng-disabled="{{sForm.disabled}}" />
    </div>
    <div class="col-sm-1">
        <input type="radio" class="radio" name="checked" ng-click="searchDisabled(sForm.val)" ng-model="formRadio.checked" value="{{sForm.val}}" ng-hide="{{!sForm.disabled}}" />
    </div>
</div>

doesn't work the ngModel value search[sForm.propertyName]. I don't know why.. Here are the properties:

$scope.sForms = [
            {
                label: 'Lastname',
                place: 'Searching lastname',
                name: 'Lname',
                val: 1,
                propertyName: 'lname',
                disabled: $scope.disabledLname,
                hideRadio: !$scope.disabledLname
            },
            {
                label: 'Firstname',
                place: 'Searching firstname',
                name: 'Fname',
                val: 2,
                propertyName: 'fname',
                disabled: $scope.disabledFname,
                hideRadio: !$scope.disabledFname
            }];

The disabled value also didn't work. when I check the first input then the second input need to be disabled.

yuro
  • 2,189
  • 6
  • 40
  • 76
  • your code appears to be affected by JavaScript Prototype Inheritance. see http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs. `ng-repeat` creates a new scope for each iteration, and primitive properties will not operate the way you expect. – Claies Sep 14 '15 at 21:54
  • @Claies Thanks for your comment..do you know what I have to do to get the correct values? – yuro Sep 15 '15 at 06:13
  • Can you share a fiddle or a plunker? Also please share the searchDisabled function. – Pratik Bhattacharya Dec 20 '15 at 19:52

0 Answers0