angularjs - Inner element (of type sting array) in scope object is not working with ng-repeat -


inner element (sting array) in scope object not working ng-repeat

    $scope.fakeoptions = ["option1","option2"];      $scope.question= {         title: "new question title",         options: ["option1","option2"],      }; 

this not working

   <div ng-repeat="option in question.options" class="col-sm-3">    <input type="text" value="{{option}}" />    </div>  

where in case working

<div ng-repeat="option in fakeoptions " class="col-sm-3"> <input type="text" value="{{option}}" /> </div> 

i new angular, in knockout using observable please assist.

not sure what's going wrong works fine, see snippet below. note should use ng-model bind values inputs , shouldn't bind directly scope values, has little issue you're describing.

angular.module("app", []).controller("ctrl", function($scope) {      $scope.fakeoptions = ["option1", "option2"];      $scope.question = {      title: "new question title",      options: ["option1", "option2"],      };    });
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>    <div ng-app="app">    <div ng-controller="ctrl">          <div ng-repeat="option in question.options" class="col-sm-3">        <input type="text" value="{{option}}" />      </div>      <hr/>      <div ng-repeat="option in fakeoptions " class="col-sm-3">        <input type="text" value="{{option}}" />      </div>    </div>  </div>


Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -