angular note2

regarding of most applications, you need to create model object to contain you data.

var messages = {};

messages.someText = 'You have started your journey.'

xxModule.controller('XXController',function($scope){

  $scope.messages = messages;

});

<p>{{messages.someText}}</p>

在稍后讨论$scope对象的时候我们将会看到,像这样创建模型对象的方式可以避免一些非预期的行为,这些行为可能是由$scope对象中的原型继承机制所导致的。

原文地址:https://www.cnblogs.com/specification/p/4345372.html