In my project, I am utilizing AngularJS to display multiple pages. One of these pages contains a smart-table where I showcase the details of "users". When I wish to edit one of the users, I aim to display the edit page as a popup window.
Below is an excerpt from my app.js file:
config.$inject = ['$routeProvider', '$locationProvider'];
function config($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
controller: 'HomeController',
templateUrl: 'home',
controllerAs: 'vm'
})
.when('/login', {
controller: 'LoginController',
templateUrl: 'login',
controllerAs: 'vm'
})
.when('/register', {
controller: 'RegisterController',
templateUrl: 'register',
controllerAs: 'vm'
})
.when('/users', {
controller: 'usersListController',
templateUrl: 'users',
})
.when('/user-modal', {
templateUrl: 'user_model',
})
.otherwise({ redirectTo: '/login' });
}
Additionally, here is my controller code responsible for displaying the popup window:
this.openUser = function(row) {
service.GetUsers(row.userId).then(function(data){
var modalInstance = $uibModal.open({
templateUrl : '/user_model',
controller : 'MonitoringModalController',
};
Moreover, I utilized a Spring servlet for URL redirection. Here's a snippet of the code:
@RequestMapping(value = "/user_model", method = RequestMethod.GET)
public ModelAndView user_model(HttpServletRequest request) {
try{
logger.info("MappingController --> Users List...");
}catch(Exception e){
logger.fatal(new MasterProtectionLogger().reportError("MappingController.users()", e, logger));
}
return new ModelAndView("users/user_model");
}
When attempting to trigger the popup window display by clicking on a button, an error occurs:
angular.js:10765 GET http://localhost:8080/MasterProtection/user_model 404 (Not Found)(anonymous function) @ angular.js:10765sendReq @ angular.js:10558serverRequest @ angular.js:10268processQueue @ angular.js:14792(anonymous function) @ angular.js:14808$eval @ angular.js:16052$digest @ angular.js:15870$apply @ angular.js:16160(anonymous function) @ angular.js:23618dispatch @ jquery-2.0.3.min.js:5y.handle @ jquery-2.0.3.min.js:5 angular.js:12520 Error: [$compile:tpload] Failed to load template: ./user_model (HTTP status: 404 Not Found)