...">

Quoting through a JSON element in AngularJS

I have the following ng-repeat code:

 <li ng-repeat="vid in vids | filter:query | orderBy:orderProp"> {{vid.title}} </li> 

My question is: can I scroll through the vids and print out each key and value if I don't know the key name?

So, how would I do this in php:

 <?php foreach ($vids as $key => $val) { echo $key . "=" . $val; } ?> 
+4
source share
1 answer

I'm completely unsure of the question, but it should work

 <!DOCTYPE html> <html ng-app="myApp" > <head> <title></title> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script> </head> <body ng-controller="testctrl"> <div ng-repeat="vid in vids"> <span ng-repeat ="(key, value) in vid">{{key}} ,{{value}}</span> </div> <script> var app = angular.module('myApp', []); app.controller('testctrl', function ($scope) { $scope.vids = [{ 'adam': 10, 'amalie': 12 }, { 'adam': 12, 'amalie': 12 }]; }); </script> </body> </html> 
+5
source

Source: https://habr.com/ru/post/1482391/


All Articles