AngularJS 入门

前端之家收集整理的这篇文章主要介绍了AngularJS 入门前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<!DOCTYPE html>
<html>
<head>
<Meta charset="utf-8">

</head>
<body>

<div ng-app="">
  <p>名字 : <input type="text" ng-model="name"></p>
  <h1>Hello {{name}}</h1>
</div>

</body>

<script src="angular.min.js"></script>

</html>
<!DOCTYPE html>
<html>
<head>
<Meta charset="utf-8">

</head>
<body>

<div ng-app="" ng-init="firstName='hehongbo'">
<p>姓名是:<span ng-bind="firstName"></span></p>
</div>

</body>

<script src="angular.min.js"></script>

</html>

AngularJS表达式:

<!DOCTYPE html>
<html>
<head>
<Meta charset="utf-8">
<title>AngularJS表达式</title>
</head>
<body>

<div ng-app="">
<p>AngularJS表达式:{{5 + 5}}</p>
</div>

</body>

<script src="angular.min.js"></script>

</html>

AngularJS 应用:

<!DOCTYPE html>
<html>
<head>
<Meta charset="utf-8">
<title>AngularJS表达式</title>

</head>
<body>

<div ng-app="myApp" ng-controller="myCtrl">

名: <input type="text" ng-model="firstName"><br>
姓: <input type="text" ng-model="lastName"><br>
<br>
姓名: {{firstName + " " + lastName}}

</div>


<script src="angular.min.js"></script>
<script>
var app = angular.module('myApp',[]);
app.controller('myCtrl',function($scope) {
    $scope.firstName= "John";
    $scope.lastName= "Doe";
});
</script>

</body>

</html>
原文链接:https://www.f2er.com/angularjs/149193.html

猜你在找的Angularjs相关文章