angularjs Controller顯示Model屬性

  • 180
  • 0

myModule的message屬性,在myController設定

<script src="~/Scripts/ngcontroller.js"></script>
<div ng-app="myModule">
    <div ng-controller="myController">
        {{ message }}
    </div>
    
</div>


ngcontroller.js

var myApp = angular.module("myModule", []);

myApp.controller("myController", function ($scope) {
    $scope.message = "Angular totular";
});