Skip to content

Instantly share code, notes, and snippets.

@LocalCommit
Last active August 29, 2015 14:10
Show Gist options
  • Save LocalCommit/c933a12f597c8b6f959f to your computer and use it in GitHub Desktop.
Save LocalCommit/c933a12f597c8b6f959f to your computer and use it in GitHub Desktop.

Выводит Hello World из переменной message контролера HelloController

angular.module('app').controller('HelloController',function($scope) {
$scope.message = "Hello World";
});
$scope.messages = [{message: "Hello Department", send: "21.11.2014"},
{message: "Hello Department", send: "24.11.2014"}];
<!-- CDN Google Hosted Libraries -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<script>
function HelloController ($scope) {
// body...
// can be taken in a separate file HelloController.js
$scope.message = "Hello World";
}
</script>
<!-- код интерфейса -->
<!doctype html>
<html ng-app>
<head>
<title>First ng-app | At work</title>
</head>
<body>
<h1 ng-controller="HelloController">{{message}}</h1>
<!-- CDN Google Hosted Libraries -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<!-- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> -->
<!-- HelloController -->
<script>
function HelloController ($scope) {
// body...
$scope.message = "Hello World";
}
</script>
</body>
</html>
<script src="js/controllers/HelloController.js"></script>
<html>
<head>
<title>First ng-app | Template</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment