arrays - How repeat modelos for a specific marca in this example? -
i want repeat just of chevrolet modelos example. code
<body ng-controller="marcascontroller"> <ul ng-repeat="marca in marcas"> <li ng-repeat="tipo in marca.modelo">{{tipo.nombre}}</li> </ul> </body> var app = angular.module('app', []); app.controller('marcascontroller', ['$scope', function($scope) { $scope.marcas =[ { "nombre": "chevrolet", "image": "images/aveo.jpg", "modelo": [ {"nombre":"aveo", "color":"black"}, {"nombre":"corsa", "color":"yellow"} ], "tab": "aveo" }, { "nombre": "renault", "image": "images/aveo.jpg", "modelo": [ {"nombre":"clio", "color":"black"}, {"nombre":"sandero", "color":"red"} ], "tab": "aveo" }, ]; }]) this expample here http://plnkr.co/edit/jmhcu06dypocwozszlom?p=preview
your need utilize filter:
<ul ng-repeat="marca in marcas | filter:'chevrolet'"> https://docs.angularjs.org/api/ng/filter/filter
arrays angularjs angularjs-ng-repeat scopes
No comments:
Post a Comment