Javascript 达不到角度法
嘿,伙计们,出于某种原因,我下面的代码无效,并给出了这个结果。当我单击“保存”按钮时,窗口中没有任何警报?我想,不知何故,我没有到达角图书馆,但我不确定。谢谢你的帮助!谢谢 index.html:Javascript 达不到角度法,javascript,angularjs,Javascript,Angularjs,嘿,伙计们,出于某种原因,我下面的代码无效,并给出了这个结果。当我单击“保存”按钮时,窗口中没有任何警报?我想,不知何故,我没有到达角图书馆,但我不确定。谢谢你的帮助!谢谢 index.html: <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstr
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script data-require="angular.js@1.4.x" src="https://code.angularjs.org/1.4.8/angular.js" data-semver="1.4.8"></script>
<script src = "https://rawgit.com/nirus/Angular-Route-Injector/master/dist/routeInjector.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular-route.js"></script>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body style="margin:20px">
<div>
<label>Employee Name</label>
<input type = "text" id="employeeName" ng-model="employeeName"><br />
<label>Emploee Age</label>
<input type = "text" id="employeeAge" ng-model="employeeAge"><br />
</div>
<div>
<button class = "btn btn-default" ng-click = "saveEmployee()">
Save <span class = "glyphicon glyphicon-ok">
</button>
</div>
<div>
Emplyee Name: {{employeeName}}<br />
Employee Age: {{employeeAge}}
</div>
</body>
</html>
您需要ng应用程序和ng控制器,这应该可以工作
<body ng-app="" ng-controller="employeeCtrl" style="margin:20px">
<div>
<label>Employee Name</label>
<input type = "text" id="employeeName" ng-model="employeeName"><br />
<label>Emploee Age</label>
<input type = "text" id="employeeAge" ng-model="employeeAge"><br />
</div>
<div>
<button class = "btn btn-default" ng-click = "saveEmployee()">
Save <span class = "glyphicon glyphicon-ok">
</button>
</div>
<div>
Emplyee Name: {{employeeName}}<br />
Employee Age: {{employeeAge}}
</div>
</body>
员工姓名
就业年龄
拯救
员工姓名:{{employeeName}}
员工年龄:{{employeeAge}
尝试调用该函数,但仍然无效…您必须在HTML中添加ng应用程序和ng控制器已尝试过。。。我正在学习本教程:为什么不起作用:(
<body ng-app="" ng-controller="employeeCtrl" style="margin:20px">
<div>
<label>Employee Name</label>
<input type = "text" id="employeeName" ng-model="employeeName"><br />
<label>Emploee Age</label>
<input type = "text" id="employeeAge" ng-model="employeeAge"><br />
</div>
<div>
<button class = "btn btn-default" ng-click = "saveEmployee()">
Save <span class = "glyphicon glyphicon-ok">
</button>
</div>
<div>
Emplyee Name: {{employeeName}}<br />
Employee Age: {{employeeAge}}
</div>
</body>