Skip to content

Instantly share code, notes, and snippets.

@in-async
Created March 10, 2015 07:34
Show Gist options
  • Save in-async/862b8df1f27883cd9697 to your computer and use it in GitHub Desktop.
Save in-async/862b8df1f27883cd9697 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS Bin</title>
<style>
body {
margin: 0;
font-size: 30px;
line-height: 1.25;
}
#content {
padding: .5em;
background-color: #eee;
height: 600px;
}
</style>
</head>
<body ng-app='myApp'>
<div id="content"
ng-controller='fooCtrl'
ng-swipe-left='foo="swipe-left"'
ng-swipe-right='foo="swipe-right"'
>
{{foo}}
<div my-show-foo></div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular-touch.min.js"></script>
<script>
// myLib モジュールの作成
angular.module('myLib', [])
// myShowFoo ディレクティブの定義
.directive('myShowFoo', function() {
return {
template: 'foooooooooooooooooooooooooo by my-show-foo directive'
};
});
// ngTouch と myLib モジュールに依存
angular.module('myApp', ['ngTouch', 'myLib'])
.controller('fooCtrl', function($scope) {
$scope.foo = 'foo by app';
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment