2014-08-27 46 views
0

我試圖在按下按鈕時將視圖從一個頁面切換到另一個頁面。我正在使用ng-click,但在按下按鈕時它不切換視圖Angular ng-click與調用不起作用的函數

js文件

$scope.onCreateAppointment = function() { 

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

      }; 

     }]); 

.html文件

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

回答

2

JavaScript是區分大小寫的。範圍中不存在方法「OnCreateAppointment()」。

修復的方法是:

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

Thanks.It工作。 – Programmer345 2014-08-27 15:13:13