定義的錯誤,當我使用這個腳本:功能不Angular.js
<script>
function TestClick() {
alert("Test clic");
}
</script>
有了這個HTML代碼:
<div>
<input name="BtnAddNew" type="button" value="Load all OPCVM" onclick="TestClick()" />
</div>
它的工作原理。
但是,一旦我試圖把一切控制器內:
<head>
<meta name="viewport" content="width=device-width" />
<title>PetitsTests</title>
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="~/Scripts/angular.js"></script>
<script>
var myApp= angular.module("myApp", []);
myApp.controller('OPCVMViewModel', function ($scope, $http) {
function TestClick() {
alert("test clic");
}
});
</script>
</head>
<body ng-app="myApp">
<div ng-controller="OPCVMViewModel">
<input name="BtnAddNew" type="button" value="Load all OPCVM" onclick="TestClick()" />
</div>
</body>
然後我從official docs一個"TestClick is not defined"
錯誤...
有沒有人解決你的問題?如果是這樣,請您接受最好的答案(點擊下面的選中標記)。這將有助於其他遇到您的問題的用戶迅速找到接受的答案,並且還會給出15個代表。指向作者(: – Danziger