Top Banner
AngularJS
94

モダンAngularJS @ GDG中国2014.12.6

Apr 21, 2017

Download

Engineering

Okuno Kentaro
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: モダンAngularJS @ GDG中国2014.12.6

AngularJS

Page 2: モダンAngularJS @ GDG中国2014.12.6
Page 3: モダンAngularJS @ GDG中国2014.12.6

http://qiita.com/armorik83/items/b00818ecaf2e93734b36

Page 4: モダンAngularJS @ GDG中国2014.12.6

?AngularJS

Page 5: モダンAngularJS @ GDG中国2014.12.6

?

Page 6: モダンAngularJS @ GDG中国2014.12.6
Page 7: モダンAngularJS @ GDG中国2014.12.6
Page 8: モダンAngularJS @ GDG中国2014.12.6
Page 9: モダンAngularJS @ GDG中国2014.12.6
Page 10: モダンAngularJS @ GDG中国2014.12.6
Page 11: モダンAngularJS @ GDG中国2014.12.6
Page 12: モダンAngularJS @ GDG中国2014.12.6
Page 13: モダンAngularJS @ GDG中国2014.12.6
Page 14: モダンAngularJS @ GDG中国2014.12.6
Page 15: モダンAngularJS @ GDG中国2014.12.6
Page 16: モダンAngularJS @ GDG中国2014.12.6
Page 17: モダンAngularJS @ GDG中国2014.12.6
Page 18: モダンAngularJS @ GDG中国2014.12.6

$

Page 19: モダンAngularJS @ GDG中国2014.12.6
Page 20: モダンAngularJS @ GDG中国2014.12.6
Page 21: モダンAngularJS @ GDG中国2014.12.6
Page 22: モダンAngularJS @ GDG中国2014.12.6

?

Page 23: モダンAngularJS @ GDG中国2014.12.6
Page 24: モダンAngularJS @ GDG中国2014.12.6

http://kangax.github.io/compat-table/es6/

Page 25: モダンAngularJS @ GDG中国2014.12.6

@Directive({ selector: '[blink]' }) class Blink { constructor(elment: Element, options: Options, timeout: Timeout) { // ... } }

Page 26: モダンAngularJS @ GDG中国2014.12.6
Page 27: モダンAngularJS @ GDG中国2014.12.6

AngularJS 1

Page 28: モダンAngularJS @ GDG中国2014.12.6
Page 29: モダンAngularJS @ GDG中国2014.12.6

<div ng-controller="MainCtrl">...</div>

Page 30: モダンAngularJS @ GDG中国2014.12.6

<div>

Page 31: モダンAngularJS @ GDG中国2014.12.6

AngularJS 2

Page 32: モダンAngularJS @ GDG中国2014.12.6

$

$

Page 33: モダンAngularJS @ GDG中国2014.12.6

$

$scope

$scope

<div ng-controller="MainCtrl as main">...</div>

Page 34: モダンAngularJS @ GDG中国2014.12.6

$

$broadcast $on

Page 35: モダンAngularJS @ GDG中国2014.12.6

$broadcast, $on

!

$broadcast

$on

$scope.$broadcast('EventNameString', args);

Page 36: モダンAngularJS @ GDG中国2014.12.6

$broadcast

$scope

Page 37: モダンAngularJS @ GDG中国2014.12.6

AngularJS 3

$

Page 38: モダンAngularJS @ GDG中国2014.12.6

http://www.linkplugapp.com/a/1042855

Page 39: モダンAngularJS @ GDG中国2014.12.6
Page 40: モダンAngularJS @ GDG中国2014.12.6
Page 41: モダンAngularJS @ GDG中国2014.12.6
Page 42: モダンAngularJS @ GDG中国2014.12.6
Page 43: モダンAngularJS @ GDG中国2014.12.6
Page 44: モダンAngularJS @ GDG中国2014.12.6

AngularJS 4

Page 45: モダンAngularJS @ GDG中国2014.12.6
Page 46: モダンAngularJS @ GDG中国2014.12.6
Page 47: モダンAngularJS @ GDG中国2014.12.6
Page 48: モダンAngularJS @ GDG中国2014.12.6
Page 49: モダンAngularJS @ GDG中国2014.12.6
Page 50: モダンAngularJS @ GDG中国2014.12.6
Page 51: モダンAngularJS @ GDG中国2014.12.6
Page 52: モダンAngularJS @ GDG中国2014.12.6
Page 53: モダンAngularJS @ GDG中国2014.12.6

A new "isolate" scope.

scope: { attr: '@myAttr', foo: '=myFoo', bar: '@myBar' },

Page 54: モダンAngularJS @ GDG中国2014.12.6
Page 55: モダンAngularJS @ GDG中国2014.12.6

$templateCache.put()

Page 56: モダンAngularJS @ GDG中国2014.12.6

AngularJS 5

Page 57: モダンAngularJS @ GDG中国2014.12.6
Page 58: モダンAngularJS @ GDG中国2014.12.6
Page 59: モダンAngularJS @ GDG中国2014.12.6

function MyComponent() { // ... } !angular.module('myModule') .service('MyComponent', MyComponent); !angular.module('myModule') .factory('MyComponent', function() { return MyComponent; });

Page 60: モダンAngularJS @ GDG中国2014.12.6
Page 61: モダンAngularJS @ GDG中国2014.12.6
Page 62: モダンAngularJS @ GDG中国2014.12.6

angular.module('myModule') .factory('MyBusinessLogic', function() { return MyBusinessLogic; // インスタンスではなくコンストラクタ自体を返す

});

Page 63: モダンAngularJS @ GDG中国2014.12.6
Page 64: モダンAngularJS @ GDG中国2014.12.6

AngularJS 6

Page 65: モダンAngularJS @ GDG中国2014.12.6

$resource, $routeParams, $location

Page 66: モダンAngularJS @ GDG中国2014.12.6

AngularJS 7

Page 67: モダンAngularJS @ GDG中国2014.12.6
Page 68: モダンAngularJS @ GDG中国2014.12.6
Page 69: モダンAngularJS @ GDG中国2014.12.6
Page 70: モダンAngularJS @ GDG中国2014.12.6

1. minify対策

罠angular.module('myModule') .service('MyService', function(OtherService) { // ... ↑ここに無い!! }); !angular.module('myModule') .service('MyService', ['OtherService', function(OtherService) { // ... }]);

Page 71: モダンAngularJS @ GDG中国2014.12.6

!

!

!

.service()

ng-strict-di

1. minify対策

function MyService(OtherService) { // ... } MyService.$inject = ['OtherService']; !angular.module('myModule') .service('MyService', MyService);

<body ng-app="myApp" ng-strict-di> ... </body>

Page 72: モダンAngularJS @ GDG中国2014.12.6

2. Filter

Page 73: モダンAngularJS @ GDG中国2014.12.6

$routeProvider

3. $routeProvider

Page 74: モダンAngularJS @ GDG中国2014.12.6

4. AngularUI

Page 75: モダンAngularJS @ GDG中国2014.12.6

ng-repeat compile, link

undefined

5. directive処理順

Page 76: モダンAngularJS @ GDG中国2014.12.6

AngularJS 8

Page 77: モダンAngularJS @ GDG中国2014.12.6
Page 78: モダンAngularJS @ GDG中国2014.12.6
Page 79: モダンAngularJS @ GDG中国2014.12.6
Page 80: モダンAngularJS @ GDG中国2014.12.6
Page 81: モダンAngularJS @ GDG中国2014.12.6

root ├── Gruntfile.js ├── app │   ├── bower_components │   ├── my_components │   │   └── * │   ├── my_modules │   │   └── * │   ├── favicon.ico │   ├── fonts │   ├── images │   ├── robots.txt │   ├── scripts │   │   ├── app.js │   │   ├── controllers │   │   ├── directives │   │   ├── filters │   │   ├── injectors │   │   ├── modules │   │   ├── routes.js │   │   ├── run.js │   │   └── services │   ├── styles │   │   ├── sass │   │   └── screen.css │   └── views │   ├── 404.html │   ├── index.html │   ├── partials │   └── parts ├── bower.json ├── common │   └── * ├── doc ├── e2e.conf.js ├── karma.conf.js

│ ├── lib │   ├── bootstrap-models.js │   ├── config │   │   └── * │   ├── controllers │   │   └── * │   ├── middleware.js │   ├── models │   │   └── * │   └── routes.js ├── log ├── node_modules ├── package.json ├── server.js ├── test │   ├── client │   │   ├── e2e │   │   ├── mock │   │   └── spec │   └── server │   ├── mock │   └── spec ├── tsd.json └── typings ├── e2e.d.ts └── tsd.d.ts

Page 82: モダンAngularJS @ GDG中国2014.12.6
Page 83: モダンAngularJS @ GDG中国2014.12.6

angular.module() inject

function(){funtion(){function(){...

Page 84: モダンAngularJS @ GDG中国2014.12.6

express, lodash, log4js, mongoose,mongoose-auto-increment, passport

angular, angular-animate, angular-ui-bootstrap,d3, es5-shim, jquery, lodash, node-uuid, underscore.string

Page 85: モダンAngularJS @ GDG中国2014.12.6

connect-livereload, grunt-este-watch,grunt-express-server, grunt-karma,grunt-ng-annotate, grunt-ts, grunt-typedoc, karma, karma-phantomjs-launcher, load-grunt-tasks, protractor, time-grunt

grunt-ng-annotate

Page 86: モダンAngularJS @ GDG中国2014.12.6
Page 87: モダンAngularJS @ GDG中国2014.12.6
Page 88: モダンAngularJS @ GDG中国2014.12.6

AngularJS 9

Page 89: モダンAngularJS @ GDG中国2014.12.6
Page 90: モダンAngularJS @ GDG中国2014.12.6
Page 91: モダンAngularJS @ GDG中国2014.12.6
Page 92: モダンAngularJS @ GDG中国2014.12.6

AngularJS 1 AngularJS 2 AngularJS 3

$

AngularJS 4 AngularJS 5

AngularJS 7

AngularJS 8 AngularJS 9

AngularJS 6

Page 93: モダンAngularJS @ GDG中国2014.12.6

AngularJS 10

Have a good AngularJS!

Page 94: モダンAngularJS @ GDG中国2014.12.6