双花括号(angularjs)不起作用?

时间:2016-04-13 13:28:41

标签: angularjs html5 visual-studio-code

以下是我正在处理的代码:

 <!DOCTYPE html>
 <html lang="en-US">
      <head>
         <title>HTML Page</title>
         <script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
         <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
         <script src="js/angu.js"></script>
     </head>
     <body>
        <div ng-controller="homeController">
        <label>Username:</label>
        <input type="text" ng-model="uname" placeholder="Enter username" />
        <hr />
        <h2>Hello {{ uname }}</h2>
        <button type="button" ng-click="testMe()">Test Me</button>
        </div>
     </body>
</html>

angu.js:

var app = angular.module('basicApp', []);
app.controller('homeController', function ($scope) {
   $scope.uname = "demouser";
    $scope.testMe = function () {
        $scope.uname += "123";
    };
});

输出的问题部分:

  

您好{{uname}}

您能否帮我找一下为什么在Visual Studio Code中显示双花括号的原因。我错过了什么吗?感谢。

1 个答案:

答案 0 :(得分:1)

尝试:

<html lang="en-US" ng-app="basicApp">