The server returns the data in the model of the angulyar

.success(function (response) { $scope.pageData = response; }) 

response is:

 array(5) { [0]=> array(3) { ["order"]=> string(1) "1" ["isDone"]=> bool(true) ["title"]=> string(41) "Title1" } [1]=> array(3) { ["order"]=> int(2) ["isDone"]=> bool(false) ["title"]=> string(65) " Title2" } [2]=> array(3) { ["order"]=> int(3) ["isDone"]=> bool(false) ["title"]=> string(49) " Title3" } [3]=> array(3) { ["order"]=> int(4) ["isDone"]=> bool(false) ["title"]=> string(37) " Title4" } [4]=> array(3) { ["order"]=> int(5) ["isDone"]=> bool(false) ["title"]=> string(42) " Title5" } } 

How in a view will address the necessary element on an index?

For example <input ng-model='pageData[2]["isDone"]'/> - nothing

  • response имеет вид - it is in php it is, and how does it look in json? just output to the console and see - Grundy
  • array (5) {[0] => array (3) {["order"] => string (1) "1" ["isDone"] => bool (true) ["title"] => string (41 ) "Title1"} [1] => array (3) {["order"] => int (2) ["isDone"] => bool (false) ["title"] => string (65) "Title2 "} [2] => array (3) {[" order "] => int (3) [" isDone "] => bool (false) [" title "] => string (49)" Title3 "} [ 3] => array (3) {["order"] => int (4) ["isDone"] => bool (false) ["title"] => string (37) "Title4"} ...} } The same ... - Igor Baranyuk
  • If JSON.stringify (response) "array (12) {\ n [0] => \ n array (3) {\ n [\" order \ "] => \ n string (1) \" 1 \ "\ n [\ "isDone \"] => \ n bool (true) \ n [\ "title \"] => \ n string (41) \ "Title1 \" \ n} \ n [1] => .. - Igor Baranyuk
  • it looks more like a string :-) Are you sure that you give json in your php? - Grundy
  • I would even say - this is exactly the string. and the content itself looks like just a variable dump - Grundy

0