【发布时间】:2015-12-27 16:39:50
【问题描述】:
我有 html 模板:
<div ng-controller="MyController">
<form novalidate>
Name: <input type="text" ng-model="user.name" />
<button ng-click="greet(user)">GREET</button>
</form>
</div>
我这样添加它:
"<div ng-include src=\"'/views/template.html'\"></div>"
这是MyController中的函数:
$scope.user = {}
$scope.greet = function (user) {
alert('hello ' + user.name)
}
但是当我点击按钮时,它会提交它并不会调用 greet 函数。
我也尝试将type="button" 添加到它,但它是相同的。
Here is the working solution 所以我不知道我错过了什么。
【问题讨论】:
-
我试过你提供的代码,我这边没有提交表单。可能在应用程序中,您有另一个强制提交表单的处理程序。
标签: angularjs angular-leaflet-directive