Calling function with angular ng-click doesn't work


Program 345

I am trying to switch the view from one page to another when a button is pressed. I'm using ng-click but it doesn't switch views when the button is pressed

.js file

$scope.onCreateAppointment = function () {

              $scope.templates.myTemplate = "views/calendar.html";

            };

        }]);

.html file

    ng-click="OnCreateAppointment()">Create Appointment</button>
tom

Javascript is case sensitive. Method 'OnCreateAppointment()' does not exist on scope.

The workaround is:

 <button ng-click="onCreateAppointment()">Create Appointment</button>

Related


Calling function with angular ng-click doesn't work

Program 345 I am trying to switch the view from one page to another when a button is pressed. I'm using ng-click but it doesn't switch views when the button is pressed .js file $scope.onCreateAppointment = function () { $scope.templates.myTempla

Angular ng-keyup doesn't work when calling function

Elliott Coe I have the following code: <input type="text" ng-model="keywords" ng-keyup="search()"> Where is it not calling the search function, if I do ng-click="search()" it does work. why is it like this? Matt Way ng-keyupWorks fine for me. See this fiddle

Angular ng-keyup doesn't work when calling function

Elliott Coe I have the following code: <input type="text" ng-model="keywords" ng-keyup="search()"> Where is it not calling the search function, if I do ng-click="search()" it does work. why is it like this? Matt Way ng-keyupWorks fine for me. See this fiddle

Angular ng-keyup doesn't work when calling function

Elliott Coe I have the following code: <input type="text" ng-model="keywords" ng-keyup="search()"> Where is it not calling the search function, if I do ng-click="search()" it does work. why is it like this? Matt Way ng-keyupWorks fine for me. See this fiddle

Angular ng-keyup doesn't work when calling function

Elliott Coe I have the following code: <input type="text" ng-model="keywords" ng-keyup="search()"> Where is it not calling the search function, if I do ng-click="search()" it does work. why is it like this? Matt Way ng-keyupWorks fine for me. See this fiddle

ng-show calling function doesn't work

ps0604 In this PLUNK I have a div that has an ng-showelement in it that calls a function that show()returns false . Therefore, I want the div not to be displayed. Also, see that the show()function is called twice (console.log shows the variable twice) sh. how

Angular ng-click doesn't work with $compile

freddy83 I have code similar to the following code to trigger events in an clickAngular app . Why doesn't the event fire? var app = angular.module("myApp", []) app.directive('myTop',function($compile) { return { restrict: 'E', template: '<div></div>',

Angular toggle variable in ng-click doesn't work

amnesia I have a table that lists customers, and for customers that also have a list of customers, the user can click on the table row to display that list. HTML looks like this: <tbody ng-repeat ="item in customers | clientSettingsFilter:customerId">