ile veri alın.
Ama iş devam etmeli! ;)AngularJS - Yepyeni bir yıl önce ID
Aşağıdaki durumla karşılaşıyorum:
Bazı özel işaretçilerden statik (non google) bir harita aldım. Bu kontrol cihazı/yönlendirme
<div class="alldealermodal" ng-controller="DealerDetailsCtrl">
<div ng-view></div>
</div>
: başarıyla ID görüntülemek için "satıcı-details.html" için
<div ng-controller="DealerDetailsListCtrl">
<a ng-click="showdetails=!showdetails" href="#/dealer/{{marker.id}}" class="marker" style="left:{{marker.left}};top:{{marker.top}}" ng-repeat="marker in dealer|zipFilter:zipCodeLookup:countryLookup"></a>
</div>
I yol o: (ve filtre) bu kodla işaretleyici görüntüler :
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/dealer/:id', {templateUrl: 'files/tpl/dealer-details.html', controller: DealerDetailsCtrl}).
otherwise({redirectTo: '/'});
}]);
ve
function DealerDetailsCtrl($scope, $routeParams) {
$scope.id = $routeParams.id;
}
AngularJS için çok yeni olduğum için bilmek istiyorum, tüm verileri ID ile nasıl alabilirim. böylece
[
{
"id": "2",
"name": "Laden Dortmund",
"strasse": "Unionstr.",
"hausnr": 1,
"plz": "45525",
"stadt": "Dortmund",
"land": "DE",
"url": "http://www.google.de",
"tel": "0234-234568",
"email": "[email protected]",
"left": "200px",
"top": "300px",
"lowRange":60000,
"highRange":70000
},
{
"id": "1",
"name": "Laden Unna",
"strasse": "Berlinerstr.",
"hausnr": 134,
"plz": "78654",
"stadt": "Unna",
"land": "AT",
"url": "http://www.bing.de",
"tel": "0234-11223344",
"email": "[email protected]",
"left": "250px",
"top": "500px",
"lowRange":40000,
"highRange":50000
}
]
ve .... ve ben seçilmiş id tüm verileri almak istiyorum:
Benim json dosyası bu gibi görünüyor. Bunu nasıl yapabilirim? Birisi bir ipucu verebilir mi?
ben json TÜM verileri almak için bu denetleyici kullanmak:
function DealerListCtrl($scope, $http) {
$scope.dealer = [];
$http.get('files/js/dealer.json').success(function(data) {
$scope.dealerall = data;
});
$scope.orderProp = 'id';
}
çok teşekkür ederiz!
Sadece bir işlevdeki diziyi yineleyin ve nesneyi doğru kimlikle döndürün? –