久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

angular.js - 請問為什么我的html顯示的是{{greeting.text}},Angular而不是Hello,Angular

瀏覽:67日期:2024-03-03 15:51:07

問題描述

請問為什么我的html顯示的是{{greeting.text}},Angular而不是Hello,Angularhtml

<!DOCTYPE html><html ng-app><head> <meta charset='UTF-8'> <title>Title</title> <script src='http://m.baoyu77737.com/wenda/js/angular.js'></script> <script src='http://m.baoyu77737.com/wenda/js/HelloAngular-MVC.js'></script></head><body> <p ng-controller='HelloAngular'><p>{{greeting.text}},Angular</p> </p></body></html>

JS

function HelloAngular($scope) { $scope.greeting ={text:’hello’ };}

頁面顯示為:{{greeting.text}},Angular

問題解答

回答1:

自己看看官網鏈接描述就曉得了,你這函數也沒調用啊

回答2:

數據雙向綁定,在angular上教程上

回答3:

例子<!DOCTYPE html><html><meta charset='utf-8'><script src='http://cdn.static.runoob.com/...

<body>

<p ng-app='myApp' ng-controller='myCtrl'>

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

</p>

<script>var app = angular.module(’myApp’, []);app.controller(’myCtrl’, function($scope) {

$scope.firstName = 'John';$scope.lastName = 'Doe';

});</script>

</body></html>

回答4:

在你的html文檔中 ng-app 應該賦值(和js中定義的相同),eg: ng-app='DemoApp'

標簽: HTML
主站蜘蛛池模板: 公主岭市| 章丘市| 临潭县| 天长市| 佛山市| 尼勒克县| 云浮市| 灵璧县| 上蔡县| 育儿| 射阳县| 玉龙| 大理市| 融水| 呼和浩特市| 祁阳县| 常州市| 筠连县| 阿城市| 长泰县| 沈丘县| 奎屯市| 张家港市| 大宁县| 丰顺县| 沙田区| 大余县| 东兰县| 新宾| 汝城县| 区。| 仪征市| 临夏市| 两当县| 盘锦市| 确山县| 安龙县| 富源县| 泗洪县| 秭归县| 阜城县|