Sunday, 15 March 2015

javascript - AngularJS using ng-click inside a div -


I can not get ng-click to work, I try to pass it a URL inside a single device The user goes to the next page when I click it, but when I click on the div, I can see that it is getting the right link but instead of going to the next page, it returns home.

  & lt; Div ng-repeat = "contatosCliente in contatos" class = "conteudo" type = "item-link" ng-click = "urlcontato ('# / app / contatos /' + contatosCliente.contatos_id)" & gt; {{ContatosCliente.nome}} & lt; I class = "ion-ios-arrow-right" style = "border: none; padding-right: 11px" & gt; & Lt; / I & gt; & Lt; / Div & gt;  

and my controller:

  $ scope.urlcontato = function (path) {$ location.path (path); };  

$ location.path with just one call Should be forward slash without that hash

  & lt; Div ng-repeat = "contatosCliente in contatos" class = "conteudo" type = "item-link" ng-click = "urlcontato ('/ app / contatos /' + contatosCliente.contatos_id)" & gt;  

And you should check to make sure that your view is bound by your controller to ensure that urlcontato is being called, Add some logging or debugger statement to your function.


No comments:

Post a Comment