1、错误描述
2、错误原因
<!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <title></title> <script type="text/javascript" src="../js/angular.min.js" ></script> <script> </script> </head> <body> <div> <input type="text" ng-model="username" placeholder="请输入用户名" /><br> {{username}} </div> </body> </html>
页面展示的是username变量,没有展示成需要的;由于该变量没有受AngularJS控制,需要添加ng-app
3、解决办法
<!DOCTYPE html> <html ng-app> <head> <Meta charset="UTF-8"> <title></title> <script type="text/javascript" src="../js/angular.min.js" ></script> <script> </script> </head> <body> <div> <input type="text" ng-model="username" placeholder="请输入用户名" /><br> {{username}} </div> </body> </html>原文链接:https://www.f2er.com/angularjs/149087.html