angular.js - angular controller-scope problem
伊谢尔伦
伊谢尔伦 2017-05-15 16:53:54
0
2
548

The following code:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>

</head>
<body ng-app="app">



<p ng-controller="MessageController">
    {{message}}
</p>




<script src="../../angularv1.min.js"></script>
<script src="message-controller-scope.js"></script>
</body>
</html>
/**
 * Created by Glacier on 2015/7/19.
message-controller-scope.js
 */
function MessageController($scope) {
    $scope.message = "This is a model.";
}

The displayed result is {{message}}; it should be displayed as This is a model.
Why does it show unsuccessful?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
仅有的幸福

Child, your angular objects are not loaded yet! ! !

angular.module("app", []).controller("MessageController", function($scope){
     $scope.message = "This is a model.";
});
世界只因有你

I think the problem may be
<script src="../../angularv1.min.js"></script>
This sentence, please check if the path is correct
If angularJS can be introduced, then ng-app="app" can be scanned and run by itself. Then {{message}} what you see will not be {{message}}, or it will be 'This is a model.', Either it’s blank or there’s an error in the console.

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