i was trying to call one function from another function using angular.js but it gave the following error.
TypeError: $scope.addwithDept is not a function
I am explaining my code below.
Rolecontroller.js:
var dashboard = angular.module('Channabasavashwara');
dashboard.controller('roleController', function ($scope, $http, $state) {
$scope.buttonName = "Add";
$scope.addUserRoleData = function () {
if ($('#addProfileData')[0].defaultValue == 'Add') {
if ($scope.showDept) {
$scope.addwithDept();
} else {
$scope.addwithOutDept();
}
}
}
$scope.addWithDept = function () {
console.log('hii');
}
})
The error is coming at function inside the if statement.Please help me to resolve this error.