Angular.js change ng-click location

I've read some other posts on the same topic, but can't seem to get myself to work. Basically, I want the location of my app to change to an ng-click event. So I have html code that looks like this:

<button class="button icon-left ion-plus-round button-block button-calm" ng-click="send({{}})">
    Add Calories


And a controller that looks like this:

.controller('foodDetailCtrl', function($scope, $stateParams, $location, foods) {
$scope.foods = foods.get($stateParams.foodsId);

$scope.send = function(i) {
// do something with 'i'





But when I click on my html button, the location is updated on the home tab as if it can't find "/ calc". I tried calc preceeded by parent folders and followed by file extension but couldn't get this to work. Any help was massively appreciated.


source to share

2 answers

try it

in html




$scope.send = function(event, i) {
// do something with 'i'




you can also try using $ state

instead $location.path('/calc')




Try the following:

app.config(function($routeProvider) {


And try adding a base tag to your html header.



All Articles