Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 模型表达式在angular js中不起作用_Angularjs_Expression - Fatal编程技术网

Angularjs 模型表达式在angular js中不起作用

Angularjs 模型表达式在angular js中不起作用,angularjs,expression,Angularjs,Expression,未使用文本框中键入的值更新表达式 <html> <head> <title>Angular Test</title> <meta charset="UTF-8"> <script src="angular.js" type="text/javascript"> </script> <script> var a

未使用文本框中键入的值更新表达式

<html>
    <head>
        <title>Angular Test</title>
        <meta charset="UTF-8">
        <script src="angular.js" type="text/javascript"> </script>
        <script>
           var app=angular.module("myApp",[]);
           app.controller("ctrl",function($scope){
                $scope.name="asdfsdf";
           });
        </script>
    </head>
    <body ng-app="myApp" ng-controller="ctrl" >
        <input type="text" ng-bind="name" /> {{name}}
    </body>
</html>

角度测试
var-app=angular.module(“myApp”,[]);
应用程序控制器(“ctrl”,函数($scope){
$scope.name=“asdfsdf”;
});
{{name}}

将ng绑定更改为ng模型…..ng模型提供双向绑定,而as ng绑定仅提供单向绑定

<html>
    <head>
        <title>Angular Test</title>
        <meta charset="UTF-8">
        <script src="angular.js" type="text/javascript"> </script>
        <script>
           var app=angular.module("myApp",[]);
           app.controller("ctrl",function($scope){
                $scope.name="asdfsdf";
           });
        </script>
    </head>
    <body ng-app="myApp" ng-controller="ctrl" >
        <input type="text" ng-model="name" /> {{name}}
    </body>
</html>

角度测试
var-app=angular.module(“myApp”,[]);
应用程序控制器(“ctrl”,函数($scope){
$scope.name=“asdfsdf”;
});
{{name}}

ng绑定
更改为
ng模型
,以更新输入值


角度测试
var-app=angular.module(“myApp”,[]);
应用程序控制器(“ctrl”,函数($scope){
$scope.name=“asdfsdf”;
});
{{name}}