generator-angular-fullstack
generator-angular-fullstack copied to clipboard
Modal Service. Modal delete throw exception.
- [x] I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests.
| Item | Version |
|---|---|
| generator-angular-fullstack | 4.2.2 |
| Node | 8.1.4 |
| npm | 5.0.3 |
| Operating System | Windows 7 |
| Item | Answer |
|---|---|
| Transpiler | Babel |
| Markup | HTML |
| CSS | SCSS |
| Router | ngRoute / ui-router |
| Client Tests | Jasmine / Mocha |
| DB | MongoDB |
| Auth | Y |
I tried to make use of the modal component to confirm user's deletion...
The following exception occurs:
angular.js:14642 TypeError: CreateListFromArrayLike called on non-object
at AdminController.delete (modal.service.js:44)
at fn (eval at compile (angular.js:15500), <anonymous>:4:244)
at callback (angular.js:27285)
at ChildScope.$eval (angular.js:18372)
at ChildScope.$apply (angular.js:18472)
at HTMLAnchorElement.<anonymous> (angular.js:27290)
at defaultHandlerWrapper (angular.js:3771)
at HTMLAnchorElement.eventHandler (angular.js:3759)
admin.controller.js
'use strict';
export default class AdminController {
/*@ngInject*/
constructor(User, Modal) {
// Use the User $resource to fetch all users
this.users = User.query();
// Our callback function is called if/when the delete modal is confirmed
this.delete = Modal.confirm.delete(user => {
user.$remove();
this.users.splice(this.users.indexOf(user), 1);
});
}
}
The line causing the exception is the 3rd one in the following block:
return function(args) {
console.log(typeof(args));
var slicedArgs = Reflect.apply(Array.prototype.slice, args);
var name = slicedArgs.shift();
var deleteModal;
The console.log(typeof(args)) displays "object" in the console..
What's wrong...
I am having the same issues. I have tried a multitude of ways of initiating the modal yet no joy for me..
We're going to be retiring the Modal component in the next version, for reasons just like this. I'd suggest using the UI Bootstrap Modal directly: https://angular-ui.github.io/bootstrap/#!#modal