मैं स्वत: पूर्ण करने की कोशिश कर रहा हूं जिसमें यूआरएल से डेटा लिया जाता है। मैंने एक कोड लिखा है लेकिन इसका प्रदर्शन अनिर्धारित है। क्या कोई इस समस्या को हल करने में मेरी सहायता करता है
//html file
<!DOCTYPE html>
<html ng-app="myapp">
<head>
<meta charset="utf-8">
<title>Autocomplete using remote searching</title>
<script src="angularfiles/angular.min.js"></script>
<script src="angularfiles/angular-animate.js"></script>
<script src="angularfiles/ui-bootstrap-tpls-0.13.4.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="Jsfiles/autourl.js"></script>
</head>
<body ng-controller="controller">
<div class="ui-widget">
<input type="text" ng-model="asyncselected" typeahead="r.city for r in getlist($viewValue)" typeahead-loading="loadingLocations" typeahead-no-results="noResults">
<i ng-show="loadingLocations" class="glyphicon glyphicon-refresh"></i>
<div ng-show="noResults">
<i class="glyphicon glyphicon-remove"></i> No Results Found
</div>
</div>
</body>
</html>
//Js file
var app=angular.module("myapp",["ui.bootstrap"]);
app.controller("controller",["$scope","$http",function($scope,$http){
$scope.getlist=function(val){
return $http.get("http://www.w3schools.com/angular/customers.php").then(function(response){
return response.data.results.map(function(item){
return item.City;
});
});
};
}]);
जेएसफ़ाइल कोड कुछ गलत हो सकता है..मैं पहचानने में असमर्थ हूं। क्या कोई मुझे हल करने में मदद कर सकता है।
उत्तर:
जवाब के लिए 0 № 1आप एक कोणीय यूआई निर्देश का उपयोग कर सकते हैं। यह एक अच्छा दृष्टिकोण है और मैं इसका उपयोग करता हूं।
https://angular-ui.github.io/bootstrap/