As a newcomer to AngularJS, I am struggling with the following code snippet:
This is the component defined in the JavaScript file provided:
angular.module('EasyDocsUBBApp')
.component('loginTag', {
templateUrl: 'login-tag/login-tag.html',
controller: function () {
alert(1);
this.login = function () {
console.log(this.username + ':' + this.password);
};
}
});
In addition, here is a snippet from my app.js file where routing is configured:
var app = angular.module('EasyDocsUBBApp', ['ngRoute']);
app.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'login-tag/login-tag.html'
})
.when('/test', {
templateUrl: 'test.html'
})
.otherwise({
redirectTo: 'login-tag/login-tag.html'
});
});
I am facing an issue where the controller does not seem to load (the alert window never shows up). Can anyone point out what might be wrong in my code? Any additional details needed for better assistance can be provided upon request.