Tag: $scope not working in function