Small files structure example using a material modal window
josoroma-zz opened this issue · 1 comments
josoroma-zz commented
Hi hackers!
I was wondering if there is a small example of how to use a material modal window to add a item, for example, I am stuck in the following code because I really don't know how to create the files for the HomeAddController:
class HomeController {
constructor($mdDialog) {
"ngInject";
this.mdDialog = $mdDialog;
this.name = 'home';
}
getItems() {
// ...
}
addItem(event) {
console.log('addItem');
this.mdDialog.show({
clickOutsideToClose: true,
controller: 'HomeAddController',
controllerAs: '$ctrl',
focusOnOpen: false,
targetEvent: event,
templateUrl: './modal/home.add.html'
}).then(this.getItems);
}
$onInit() {
//
}
}
export default HomeController;
Thanks in advance!
josoroma-zz commented
I just discover a useful pattern:
https://gist.github.com/coderlavalle/72a186f3f2cc30d31489113162e111cc