angular.js - angular beginners problem with simple controller
大家讲道理
大家讲道理 2017-05-15 17:11:15
0
2
517
视图
<!doctype html>
<html ng-app>
    <head>
       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="angularJs/angular.min.js"></script>
        <script src="angulartest.js"></script>
   <style>
       input.ng-invalid{
           background: blue;
       }     
   </style>
    </head>
    <body >
        <p ng-app="myapp" ng-controller="myctrl">
            {{myname}}
        </p>

    </body>
</html>
控制器
var app=angular.module('myapp',[]);
app.controller('myctrl',function($scope){
$scope.myname="zx";
});

I have been having problems and I don’t know why. Please help

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
伊谢尔伦

Please remove ng-app from the html tag

<html ng-app>  --》  <html>
阿神

1. Leave one of the two ng-apps;
2. Use ng-app="myapp" for the remaining one;
3. Do not add ng-app to the html.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template