Double curly braces (angularjs ) don't work? [

2019-07-23 22:10发布

Here is the code I am working on:

 <!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";
    };
});

Problematic part of the Output:

Hello {{ uname }}

Could you please help me to find out why double curly braces are shown as it is in Visual Studio Code. Am I missing something? Thanks.

1条回答
等我变得足够好
2楼-- · 2019-07-23 23:16

Try:

<html lang="en-US" ng-app="basicApp">
查看更多
登录 后发表回答