javascript - AngularJS using ng-click inside a div -


i can't ng-click work, i'm trying pass url inside div when user clicks goes next page, when click on div can see getting right link instead of going next page returns home.

<div ng-repeat="contatoscliente in contatos" class="conteudo" type="item-link" ng-click="urlcontato('#/app/contatos/' + contatoscliente.contatos_id)">                      {{contatoscliente.nome}}                     <i class="ion-ios-arrow-right" style="border: none; padding-right: 11px"></i>                  </div> 

and controller:

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

$location.path should called forward slash, without hash.

https://docs.angularjs.org/api/ng/service/$location

<div ng-repeat="contatoscliente in contatos" class="conteudo" type="item-link" ng-click="urlcontato('/app/contatos/' + contatoscliente.contatos_id)"> 

and should check make sure view bound controller. add logging in function, or use debugger statement, make sure urlcontato being called.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -