I attempted to dynamically load a template in Angular using ngRoute... However, I encountered an issue with the following code:
(app.js route configuration)
app.config(function($routeProvider) {
$routeProvider.when("/password", {
templateUrl : "../password/index.html",
controller: 'LoginController',
controllerAs : 'loginCtrl',
reloadOnSearch : false
});
});
This is the HTML template (../password/index.html)
<div class=" et_pb_row et_pb_row_0">
....
<form ng-submit="loginCtrl.controllaPassword()">
....
</div>
(app.js controller )
this.controllaPassword = function(){
alert("kuajia");
};
Currently, the code appears on the main HTML page (login.html) where I declare ng-app, but the alert does not show up.