双花括号(angularjs)不起作用? [英] Double curly braces (angularjs ) don't work?

查看:102
本文介绍了双花括号(angularjs)不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

输出中有问题的部分:


Hello {{uname}}

Hello {{ uname }}

您能否帮我找出为什么会出现双花括号?就像在Visual Studio代码中一样。我错过了什么吗?谢谢。

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.

推荐答案

尝试:

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

这篇关于双花括号(angularjs)不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆