Skip to content

Instantly share code, notes, and snippets.

@MSakamaki
Created November 27, 2014 01:45
Show Gist options
  • Save MSakamaki/d3d5689f27ea4b0b5cea to your computer and use it in GitHub Desktop.
Save MSakamaki/d3d5689f27ea4b0b5cea to your computer and use it in GitHub Desktop.
forked: AngularJS
* {
margin: 0;
padding: 0;
border: 0;
}
body {
background: #dfd;
font: 30px sans-serif;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.1/angular.js" ></script>
<script src="http://ajax.aspnetcdn.com/ajax/mobileservices/MobileServices.Web-1.2.5.min.js"></script>
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>今日の勉強</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<style>
input.ng-invalid.ng-dirty {
border-color: #ff0000;
}
</style>
</head>
<body ng-app>
<input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'>pasted: {{paste}}<br>
<input ng-copy="copied=true" ng-init="copied=false; copyvalue='copy me'" ng-model="copyvalue">copied: {{copied}}<br>
<input ng-cut="cut=true" ng-init="cut=false; cutvalue='cut me'" ng-model="cutvalue">cut: {{cut}}<br>
<script>
</script>
</body></html>
'use strict';
angular.module('azureApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ui.router',
'ui.bootstrap'
]).config(['$stateProvider',
'$urlRouterProvider',
'$locationProvider',
function (a, b, c) {
b.otherwise('/'),
c.html5Mode(!0)
}
]),
angular.module('azureApp').controller('MainCtrl', [
'$scope',
'$http',
function (a, b) {
a.awesomeThings = [
],
b.get('/api/things').success(function (b) {
a.awesomeThings = b
})
}
]),
angular.module('azureApp').config(['$stateProvider',
function (a) {
a.state('main', {
url: '/',
templateUrl: 'app/main/main.html',
controller: 'MainCtrl'
})
}
]),
angular.module('azureApp').controller('SampleCtrl', [
'$scope',
function (a) {
var b = new WindowsAzure.MobileServiceClient('https://albass.azure-mobile.net/', 'EZNfvLQZgxJtikwBcolHMLdccLPPYj45');
b.getTable('Item').read().done(function (b) {
console.log('results: ' + b);
try {
console.log('exists'),
a.items = b
} catch (c) {
console.log('doesnt exist yet')
}
})
}
]),
angular.module('azureApp').config(['$stateProvider',
function (a) {
a.state('sample', {
url: '/sample',
templateUrl: 'app/sample/sample.html',
controller: 'SampleCtrl'
})
}
]),
angular.module('azureApp').factory('Modal', [
'$rootScope',
'$modal',
function (a, b) {
function c(c, d) {
var e = a.$new();
return c = c || {
},
d = d || 'modal-default',
angular.extend(e, c),
b.open({
templateUrl: 'components/modal/modal.html',
windowClass: d,
scope: e
})
}
return {
confirm: {
'delete': function (a) {
return a = a || angular.noop,
function () {
var b,
d = Array.prototype.slice.call(arguments),
e = d.shift();
b = c({
modal: {
dismissable: !0,
title: 'Confirm Delete',
html: '<p>Are you sure you want to delete <strong>' + e + '</strong> ?</p>',
buttons: [
{
classes: 'btn-danger',
text: 'Delete',
click: function (a) {
b.close(a)
}
},
{
classes: 'btn-default',
text: 'Cancel',
click: function (a) {
b.dismiss(a)
}
}
]
}
}, 'modal-danger'),
b.result.then(function (b) {
a.apply(b, d)
})
}
}
}
}
}
]),
angular.module('azureApp').controller('NavbarCtrl', [
'$scope',
'$location',
function (a, b) {
a.menu = [
{
title: 'Home',
link: '/'
},
{
title: 'Sample',
link: '/sample'
}
],
a.isCollapsed = !0,
a.isActive = function (a) {
return a === b.path()
}
}
]),
angular.module('azureApp').run(['$templateCache',
function (a) {
a.put('app/main/main.html', '<div ng-include="\'components/navbar/navbar.html\'"></div><header class=hero-unit id=banner><div class=container><h1>\'Allo, \'Allo!</h1><p class=lead>Kick-start your next web app with Angular Fullstack</p><img src=assets/images/d535427a.yeoman.png alt="I\'m Yeoman"></div></header><div class=container><div class=row><div class=col-lg-12><h1 class=page-header>Features:</h1><ul class="nav nav-tabs nav-stacked col-md-4 col-lg-4 col-sm-6" ng-repeat="thing in awesomeThings"><li><a href=# tooltip={{thing.info}}>{{thing.name}}</a></li></ul></div></div></div><footer class=footer><div class=container><p>Angular Fullstack v2.0.13 | <a href=https://twitter.com/tyhenkel>@tyhenkel</a> | <a href="https://github.com/DaftMonk/generator-angular-fullstack/issues?state=open">Issues</a></p></div></footer>'),
a.put('app/sample/sample.html', '<div ng-include="\'components/navbar/navbar.html\'"></div><ul><li ng-repeat="data in items">{{data.id}} - {{data.text}}</li></ul>'),
a.put('components/modal/modal.html', '<div class=modal-header><button ng-if=modal.dismissable type=button ng-click=$dismiss() class=close>&times;</button><h4 ng-if=modal.title ng-bind=modal.title class=modal-title></h4></div><div class=modal-body><p ng-if=modal.text ng-bind=modal.text></p><div ng-if=modal.html ng-bind-html=modal.html></div></div><div class=modal-footer><button ng-repeat="button in modal.buttons" ng-class=button.classes ng-click=button.click($event) ng-bind=button.text class=btn></button></div>'),
a.put('components/navbar/navbar.html', '<div class="navbar navbar-default navbar-static-top" ng-controller=NavbarCtrl><div class=container><div class=navbar-header><button class=navbar-toggle type=button ng-click="isCollapsed = !isCollapsed"><span class=sr-only>Toggle navigation</span> <span class=icon-bar></span> <span class=icon-bar></span> <span class=icon-bar></span></button> <a href="/" class=navbar-brand>azure</a></div><div collapse=isCollapsed class="navbar-collapse collapse" id=navbar-main><ul class="nav navbar-nav"><li ng-repeat="item in menu" ng-class="{active: isActive(item.link)}"><a ng-href={{item.link}}>{{item.title}}</a></li></ul></div></div></div>')
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment