Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: $location.path is not a function

<span class="button-icon pull-left" ><i class="ti ti-plus" ng-click="itemOpen()"></i></span>

This is my Html Code.

 $scope.itemOpen=function()
         {
             return $location.path('/ConsultationParameterMaster');
         };

This is my script. And the error is. $location.path is not a function

like image 309
Prabhagaran Palanisamy Avatar asked Aug 24 '26 15:08

Prabhagaran Palanisamy


2 Answers

You need to inject $location in your controller if you are going to do this. where you are missing 'focus' as a parameter

app.controller('sampleController', ['$scope','$http','$location', function($scope,$http,$location) {
 $scope.itemOpen=function()
         {
             return $location.path('/ConsultationParameterMaster');
         };
}

EDIT:

According to your comment,You need to arrange the dependencies,

coreModule.registerController('MedicalRecordsController', ['$rootScope', '$scope', '$sessionStorage', 'Restangular', '$element', '$themeModule', '$filter', '$uibModal', 'gettext', 'focus', '$location', function ($rootScope, $scope, $sessionStorage, Restangular, $element, $themeModule, $filter, $uibModal, gettext,focus,$location)
like image 85
Sajeetharan Avatar answered Aug 27 '26 04:08

Sajeetharan


app.controller('ctrl', ['$http','$scope','$location', function($http,$scope,$location) {
 $scope.itemOpen=function()
         {
             return $location.path('/ConsultationParameterMaster');
         };
}
<span class="button-icon pull-left" ><i class="ti ti-plus" ng-click="itemOpen()"></i></span>
like image 26
barış çıracı Avatar answered Aug 27 '26 04:08

barış çıracı



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!