Skip to content

Instantly share code, notes, and snippets.

@HAKASHUN
Created October 17, 2013 00:54
Show Gist options
  • Save HAKASHUN/7017578 to your computer and use it in GitHub Desktop.
Save HAKASHUN/7017578 to your computer and use it in GitHub Desktop.
AngularJSでmoduleを定義して使ってみる
<!--ng-appにmyAppをセット-->
<html ng-app='myApp'>
<head>
<meta charset="UTF-8">
<title>Text</title>
</head>
<body ng-controller="TextController">
<p>{{someText.message}}</p>
<script src="../bower_components/angular/angular.js"></script>
<script>
//myAppModuleという名前のモジュールを作成
var myAppModule = angular.module('myApp', []);
//myAppModuleのコントローラを作成
myAppModule.controller(
'TextController',
function($scope){
var someText = {};
someText.message = 'You have started your journey.';
$scope.someText = someText;
}
);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment