javascript - AngularJS Access $scope in function -
i execute following function when page executed:
$scope.displaytags = function(id) { $scope.toogleselectionblocs = function selectionb(b) { // have checkbox check... } $scope.showhello() { console.log("hello world!"); } }
then have other checkbox: (same controller other function)
$scope.checkclick = function(){ if($scope.mycheckbox == true){ $scope.showhello(); } }
i have following error:
typeerror: undefined not function @ scope.$scope.checkclick (....)
how can fix it?
thanks help!
you have mistake in function thats should be:
$scope.showhello = function() { console.log("hello world!"); }
and thing why write function inside function, should move $scope.showhello outside of $scope.displaytags
Comments
Post a Comment