仍然没有定义角度

时间:2017-12-06 07:24:06

标签: angularjs

这是html文件

<!DOCTYPE html>

<html ng-app="myApp">

    <head>

        <title>BlogIt!</title>
        <script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
        <script type="text/javascript" src="app.js"></script>
    </head>

    <body ng-controller="myCtrl">

        {{message}}

    </body>

</html>

这是js文件

var app = angular.module('myApp', []);

app.controller('myCtrl', function($scope){

    $scope.message = "Welcome to BlogIt!";

})

1 个答案:

答案 0 :(得分:2)

使用此编辑:

<head>
    <title>BlogIt!</title>
    <script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
    {{message}}
</body>