i want to display names into cards from the page http://task.move.pk/get.php i am new to angular had searches CORS placed the header to the php file done every google search but not complete this simple task
if you run your app locally on chrome you can start chrome with the flag "–disable-web-security"
or there are some cors extensions
for an apache server you can use this:
http://www.w3.org/wiki/CORS_Enabled
after i build on android does it work on it or i have to search for external plugin
you do not run in cors problem on real devices with your built version.
But the browsers handles cors so you deactivate it with a browser-configuration or an extension (on client side) or on backendside, but then you need to reconfigure it.
this error appears in console
indent preformatted text by 4 spaces
Error: [ngRepeat:dupes] http://errors.angularjs.org/1.4.4/ngRepeat/dupes?p0=x%20in%20names&p1=string%3A%3C&p2=%3C
at Error (native)
at http://localhost/Angularjs/angular.min.js:6:416
at http://localhost/Angularjs/angular.min.js:279:39
at Object.<anonymous> (http://localhost/Angularjs/angular.min.js:129:227)
at Object.arguments.(anonymous function) [as fn] (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:1905:36)
at n.$digest (http://localhost/Angularjs/angular.min.js:130:310)
at n.scopePrototype.$digest (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:1924:23)
at n.$apply (http://localhost/Angularjs/angular.min.js:133:330)
at n.scopePrototype.$apply (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:1987:22)
at g (http://localhost/Angularjs/angular.min.js:87:340)
file of inex,html
<!doctype html>
<html>
<head>
<title>Angular Forms</title>
<script>
// define angular module/app
var formApp = angular.module('formApp', []);
formApp.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}
]);
formApp.controller('customersCtrl',function ($scope, $http) {
function getAll() {
$http.get("http://task.move.pk/get.php")
.success(function (response) {$scope.names = response;});
}
getAll();
});
// create angular controller and pass in $scope and $http
</script>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<!-- apply the module and controller to our body so angular is applied to that -->
<body ng-app="formApp" >
<ul ng-controller="customersCtrl">
<li ng-repeat="x in names">
{{ x.name }} <a href="#">delete</a>
</li>
</ul>
</body>
</html>
this means you have dublicated entries in your array.
try to add:
track by $index to your ng-repeat
<li ng-repeat="x in names track by $index">
Error disappears but the data is not retriving in ng-repeat in ng-repeat blank li repeat serverl times
maxbe your names array only contains empty entries?
it might be because of free domain hosting can u please suggest any domain hosting provider without testcookie-nginx-module