Javascript ngClick不在嵌套的ngRepeat中触发,其中填充了来自$http.post()的数据
我有一个AngularJS应用程序来搜索旅程。在问题的这一部分,我试图展示每个地区所有可用的国家。这个想法是,当你点击一个国家,一个功能必须执行。但它从不开火 有什么帮助吗 看法 的Json结果示例Javascript ngClick不在嵌套的ngRepeat中触发,其中填充了来自$http.post()的数据,javascript,angularjs,angularjs-ng-repeat,angularjs-ng-click,Javascript,Angularjs,Angularjs Ng Repeat,Angularjs Ng Click,我有一个AngularJS应用程序来搜索旅程。在问题的这一部分,我试图展示每个地区所有可用的国家。这个想法是,当你点击一个国家,一个功能必须执行。但它从不开火 有什么帮助吗 看法 的Json结果示例 $http.post("/AVProductList/GetCountriesByRegionAsync") .success(function (response) { $scope.regions = response.regions; });
$http.post("/AVProductList/GetCountriesByRegionAsync")
.success(function (response) {
$scope.regions = response.regions;
});
{
regions:[
{
Name:"Asia",
Countries:
[
{
Name: "China",
Code: "CH"
}
,...
]
}
,...
]
}
我犯了一个愚蠢的错误: “tripchoise”上的ngBlur在ngClick之前启动
SearchApp.controller("ProductSearchController", function ($scope, $http) {
$scope.date = "Vertrek";
$scope.filter = "single";
$scope.view = "";
$scope.country = "";
$scope.switchFilter = function (filter) {
if ($scope.filter != filter) {
$scope.filter = filter;
$scope.search();
}
}
$scope.switchView = function (view) {
if ($scope.view != view)
$scope.view = view;
if ($scope.view != "" && $scope.view != "countries")
$scope.search();
}
$http.post("/AVProductList/GetCountriesByRegionAsync")
.success(function (response) {
$scope.regions = response.regions;
});
$scope.search = function () {
$scope.loading = true;
$http.post("/AVProductList/SearchProductsHeader?view="+ $scope.view +"&filter=" + $scope.filter, { SearchParameters: {Country: $scope.country}})
.success(function (data) {
if ($scope.filter == "custom")
$scope.trips = data.results;
else {
if ($scope.view == "trips")
$scope.trips = data.grouped.RoundtripgroupCode.doclist.docs;
else if ($scope.view == "departures")
$scope.trips = data.response.docs;
}
});
};
$scope.changeDate = function () {
if (isValidDate($scope.date)) {
$scope.view = "departures";
$scope.search();
}
else {
$scope.date = "Vertrek";
$scope.view = "trips";
}
}
$scope.selectCountry = function (name, code) {
$scope.countrycode = code;
$scope.country = name;
$scope.view = isValidDate($scope.date) ? "departures" : "trips";
$scope.search();
}
$scope.test = function () {
alert("Hoi");
}
});
$http.post("/AVProductList/GetCountriesByRegionAsync")
.success(function (response) {
$scope.regions = response.regions;
});
{
regions:[
{
Name:"Asia",
Countries:
[
{
Name: "China",
Code: "CH"
}
,...
]
}
,...
]
}