我需要通過點擊鏈接標籤提醒路徑名,但它不適合我。由於我是angular
的新手,我對我出錯的地方感到困惑。有人可以幫助我嗎?如何警告路徑名?
這裏是我的index.html
<!DOCTYPE html>
<html>
<head>
<script data-require="[email protected]" data-semver="2.0.0-alpha.20" src="https://code.angularjs.org/2.0.0-alpha.20/angular.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="myApp" ng-controller="ProductCtrl">
<form name="frmMain" id="frmMain">
<input type="file" name="myFile" id="myFile" />
<a href="#" ngclick="showFileName()">Show Name</a>
</form>
<script>
var myApp = angular.module('myApp',[]);
function ProductCtrl($scope) {
$scope.showFileName= function(){
var fil = document.getElementById("myFile");
alert(fil.value);
}
}
</script>
</body>
</html>
這裏是我的plnkr:http://plnkr.co/edit/Cir7Ardx3OVvwPWYJNNv?p=preview
1)你拼寫錯誤的NG-點擊。 2)angular.js的URL不正確。它應該是'https:// code.angularjs.org/2.0.0-alpha.20/angular2.js' – HankScorpio
我按照你的說法做了,但沒有迴應.... –
我按照你的說法做了,但是沒有反應.wat我需要的是我點擊鏈接標記路徑名應該被警告。 –