md-dialog の ng-click に問題があります。ここに私のHTMLコードがあります
dialog.html
<md-dialog-content layout="column">
<div class="md-dialog-content">
<md-input-container>
<label>Title</label>
<input ng-model="vm.newMovie.title"/>
</md-input-container>
<md-input-container>
<label>Year</label>
<input ng-model="vm.newMovie.year"/>
</md-input-container>
<md-input-container>
<label>ID</label>
<input ng-model="vm.newMovie.id"/>
</md-input-container>
<md-button class="md-raised" ng-click="vm.test()">HEHEHE</md-button>
<md-dialog-actions>
<md-button ng-click="vm.addMovie()" class="md-raised md-primary">Add Movie</md-button>
</md-dialog-actions>
</div>
</md-dialog-content>
dialog.controller.js
(function() {
'use strict';
angular
.module('app.movies')
.controller('DialogController', DialogController);
/** @ngInject */
function DialogController($http) {
var vm = this;
vm.newMovie = {};
function trolo() {
console.log('dasa');
}
vm.test = function() {
console.log('test test');
}
vm.addMovie = function() {
console.log(vm.newMovie);
$http.post('http://192.168.0.12:3000/movies/' + vm.newMovie.title + '/' + vm.newMovie.year + "/" + vm.newMovie.id).then(function(response) {
console.log(vm.newMovie.title);
});
}
}
})();
movie.controller.js
function() {
'use strict';
angular
.module('app.movies')
.controller('MoviesController', MoviesController);
/** @ngInject */
function MoviesController($http, $mdDialog, toastr) {
var vm = this;
vm.showDialog = function($event) {
$mdDialog
.show({
clickOutsideToClose: true,
escapeToClose: true,
targetEvent: $event,
controller: 'DialogController',
templateUrl: 'app/main/movies/dialogAddMovie.html'
})
.finally(function() {
alert = undefined;
});
}
}
})();
関数 showDialog は正常に動作しますが、ng-click に適用されるメソッドが呼び出されることはありません。助けてください。ありがとう