Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. ionic.bundle.js:19387 Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: usuario in usuarios, Duplicate key: string:c, Duplicate value: c
  2. http://errors.angularjs.org/1.3.6/ngRepeat/dupes?p0=usuario%20in%20usuarios&p1=string%3Ac&p2=c
  3. at ionic.bundle.js:7888
  4. at ngRepeatAction (ionic.bundle.js:32262)
  5. at Object.$watchCollectionAction [as fn] (ionic.bundle.js:21887)
  6. at Scope.$digest (ionic.bundle.js:22020)
  7. at Scope.$apply (ionic.bundle.js:22282)
  8. at done (ionic.bundle.js:17439)
  9. at completeRequest (ionic.bundle.js:17629)
  10. at XMLHttpRequest.requestLoaded (ionic.bundle.js:17570)(anonymous function) @ ionic.bundle.js:19387(anonymous function) @ ionic.bundle.js:16350Scope.$digest @ ionic.bundle.js:22038Scope.$apply @ ionic.bundle.js:22282done @ ionic.bundle.js:17439completeRequest @ ionic.bundle.js:17629requestLoaded @ ionic.bundle.js:17570
  11.  
  12. <?php
  13.  
  14. header("Access-Control-Allow-Origin: *");
  15. header("Content-Type: text/html; charset=utf-8");
  16.  
  17. $data = file_get_contents("php://input");
  18. $objData = json_decode($data);
  19.  
  20. $dns = "mysql:host=mysql70.ramosdainformatica.com.br;dbname=ramosdainforma70";
  21. $user = "usuario";
  22. $pass = "senha";
  23.  
  24.  
  25. $counter = $objData->counter;
  26. $token = $objData->token;
  27.  
  28. try {
  29. $con = new PDO($dns, $user, $pass);
  30.  
  31. echo "Abriu con";
  32.  
  33. if(!$con){
  34. echo "Não foi possivel conectar com Banco de Dados!";
  35. }
  36. if ($token === "1f3d2gs3f2fg3as2fdg3re2t1we46er45" && isset($token)) {
  37.  
  38.  
  39. $query = $con->prepare('SELECT * FROM usuario_app ORDER BY nome LIMIT '.$counter.', 5');
  40. $query->execute();
  41.  
  42.  
  43. $out = "[";
  44. while($result = $query->fetch()){
  45. if ($out != "[") {
  46. $out .= ",";
  47. }
  48. $out .= '{"cod_user: "'.$result["cod_user"].'",';
  49. $out .= '"nome": "'.$result["nome"].'",';
  50. $out .= '"pais": "'.$result["pais"].'",';
  51. $out .= '"cep": "'.$result["cep"].'"';
  52. $out .= '"logradouro": "'.$result["logradouro"].'",';
  53. $out .= '"complemento": "'.$result["complemento"].'",';
  54. $out .= '"bairro": "'.$result["bairro"].'",';
  55. $out .= '"cidade": "'.$result["cidade"].'"';
  56. $out .= '"estado": "'.$result["estado"].'",';
  57. $out .= '"celular": "'.$result["celular"].'",';
  58. $out .= '"email": "'.$result["email"].'",';
  59. $out .= '"senha": "'.$result["senha"].'"';
  60. $out .= '"data_cadastro": "'.$result["data_cadastro"].'",';
  61. $out .= '"latitude": "'.$result["latitude"].'",';
  62. $out .= '"longitude": "'.$result["longitude"].'"}';
  63.  
  64. }
  65. $out .= "]";
  66. echo $out;
  67.  
  68.  
  69. }
  70. } catch (Exception $e) {
  71. echo "Erro: ". $e->getMessage();
  72. };
  73.  
  74. (function() {
  75. "use strict";
  76.  
  77. angular.module("myApp").controller("initCtrl", function($scope, Data){
  78. $scope.home = "Usuários";
  79. $scope.perfil = "Perfil";
  80.  
  81. $scope.usuarios = [];
  82.  
  83. var getData = function(){
  84. var params = {
  85. counter:$scope.usuarios.length,
  86. token:"1f3d2gs3f2fg3as2fdg3re2t1we46er45",
  87. };
  88.  
  89. Data.getData(params).success(function(data) {
  90. $scope.usuarios = data;
  91. }).error(function(data) {
  92. console.log(data? data: "Não foi possível acessar ao banco de dados.");
  93. });
  94.  
  95.  
  96. };
  97.  
  98. getData();
  99.  
  100.  
  101.  
  102. });
  103. })();
  104.  
  105. (function(){
  106. "use strict";
  107.  
  108. angular.module("myApp").value("Config", {
  109.  
  110. getUrl: "http://www.ramosdainformatica.com.br/food/"
  111. });
  112.  
  113. angular.module("myApp").service("Data", function($http, Config){
  114. //recuperação de dados
  115. this.getData = function(params){
  116. return $http({
  117. method: "POST",
  118. url: Config.getUrl + "apinhac.php",
  119. data: params,
  120. headers : {
  121. 'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8'
  122. }
  123. });
  124. };
  125.  
  126.  
  127. });
  128. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement