SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
A Rubyist tries Angular
Chase Southard
KYJSUG | Sept. 2013
~ a 5 day journey ~
Thursday, September 26, 13
Thursday, September 26, 13
Thursday, September 26, 13
+
Thursday, September 26, 13
Thursday, September 26, 13
Black Box
Thursday, September 26, 13
Thursday, September 26, 13
Tonnage
https://github.com/chaserx/tonnage
Thursday, September 26, 13
Rails Model &
Controller
Thursday, September 26, 13
{ sublime }
Thursday, September 26, 13
.
!"" Gemfile
!"" Gemfile.lock
!"" README.rdoc
!"" Rakefile
!"" app
#   !"" assets
#   #   !"" images
#   #   !"" javascripts
#   #   #   !"" angular
#   #   #   #   !"" controllers
#   #   #   #   #   %"" weight_measurements_ctrl.js.coffee
#   #   #   #   !"" directives
#   #   #   #   %"" services
#   #   #   #   %"" weight_measurement.js.coffee
#   #   #   !"" app.js.coffee
#   #   #   !"" application.js
#   #   #   !"" home.js.coffee
#   #   #   %"" weight_measurements.js.coffee
#   #   %"" stylesheets
#   #   !"" application.css
#   #   !"" home.css.scss
#   #   %"" weight_measurements.css.scss
#   !"" controllers
#   #   !"" application_controller.rb
#   #   !"" concerns
#   #   !"" home_controller.rb
#   #   %"" weight_measurements_controller.rb
#   !"" helpers
#   #   !"" application_helper.rb
#   #   !"" home_helper.rb
#   #   %"" weight_measurements_helper.rb
#   !"" mailers
#   !"" models
#   #   !"" concerns
#   #   %"" weight_measurement.rb
#   %"" views
#   !"" home
#   #   %"" index.html.erb
#   !"" layouts
#   #   %"" application.html.erb
#   %"" weight_measurements
!"" bin
#   !"" bundle
#   !"" rails
#   %"" rake
!"" bower_components
#   %"" angular
#   !"" angular.js
#   !"" angular.min.js
#   %"" bower.json
!"" config
#   !"" application.rb
#   !"" boot.rb
#   !"" database.yml
#   !"" environment.rb
#   !"" environments
#   #   !"" development.rb
#   #   !"" production.rb
#   #   %"" test.rb
#   !"" initializers
#   #   !"" backtrace_silencers.rb
#   #   !"" filter_parameter_logging.rb
#   #   !"" inflections.rb
#   #   !"" mime_types.rb
#   #   !"" mime_types.rb
#   #   !"" secret_token.rb
#   #   !"" session_store.rb
#   #   %"" wrap_parameters.rb
#   !"" locales
#   #   %"" en.yml
#   %"" routes.rb
!"" config.ru
!"" db
#   !"" development.sqlite3
#   !"" migrate
#   #   %"" 20130923000919_create_weight_measurements.rb
#   !"" schema.rb
#   !"" seeds.rb
#   %"" test.sqlite3
!"" lib
#   !"" assets
#   %"" tasks
!"" log
#   !"" development.log
#   %"" test.log
!"" public
#   !"" 404.html
#   !"" 422.html
#   !"" 500.html
#   !"" assets
#   #   !"" application-1afffeb91436185f61c32d45639f5763.css
#   #   !"" application-1afffeb91436185f61c32d45639f5763.css.gz
#   #   !"" application-6b984b4c27cdb87e3c095018f44fa286.js
#   #   !"" application-6b984b4c27cdb87e3c095018f44fa286.js.gz
#   #   !"" application-9ace572d6e1deba06dd0c638399c3c2b.css
#   #   !"" application-9ace572d6e1deba06dd0c638399c3c2b.css.gz
#   #   %"" manifest-7b2fc84bf5424c2ee5d8cb0c099de0ae.json
#   !"" favicon.ico
#   %"" robots.txt
!"" test
#   !"" controllers
#   #   !"" home_controller_test.rb
#   #   %"" weight_measurements_controller_test.rb
#   !"" fixtures
#   #   %"" weight_measurements.yml
#   !"" helpers
#   #   !"" home_helper_test.rb
#   #   %"" weight_measurements_helper_test.rb
#   !"" integration
#   #   %"" api_weight_measurements_test.rb
#   !"" mailers
#   !"" models
#   #   %"" weight_measurement_test.rb
#   %"" test_helper.rb
!"" tmp
#   %"" cache
#   %"" assets
#   %"" development
#   !"" sass
#   #   %"" 5587ef5cc6602d32d8b402dd40e027111957c1c9
#   #   !"" home.css.scssc
#   #   %"" weight_measurements.css.scssc
#   %"" sprockets
#   !"" 01cb31ac38786ee5b727bfddccd0ad14
#   !"" 05d0795a34c03f1655eb8cfc49fb2eac
#   !"" 07846260088cbe378436f5992acb85f2
#   !"" 0c9f5a68e10c76b2d39acc37bb242e22
#   !"" 0e780da7cd1c4685dc103ad4b341cc37
#   !"" 10c7635fffba778e532bfed7cc4afffa
#   !"" 13fe41fee1fe35b49d145bcc06610705
Thursday, September 26, 13
!"" app
#   !"" assets
#   #   !"" images
#   #   !"" javascripts
#   #   #   !"" angular
#   #   #   #   !"" controllers
#   #   #   #   #   %"" weight_measurements_ctrl.js.coffee
#   #   #   #   !"" directives
#   #   #   #   %"" services
#   #   #   #   %"" weight_measurement.js.coffee
#   #   #   !"" app.js.coffee
#   #   #   !"" application.js
#   #   #   !"" home.js.coffee
#   #   #   %"" weight_measurements.js.coffee
#   #   %"" stylesheets
#   #   !"" application.css
#   #   !"" home.css.scss
#   #   %"" weight_measurements.css.scss
Thursday, September 26, 13
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.8/
angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular-
resource.min.js"></script>
<%= javascript_include_tag "application", "data-turbolinks-track" => true
%>
</body>
</html>
Thursday, September 26, 13
<div ng-controller="WeightMeasurementsCtrl">
<div class="row">
<div class="col-md-6 col-xs-6 col-sm-6">
<h1>{{message}}</h1>
</div>
</div>
<div class="row">
<div class="col-md-6 col-xs-6 col-sm-6">
<form ng-submit="addWeightMeasurement()"
class="form-inline" role="form">
<div class="form-group">
<input type="text" ng-
model="newWeightMeasurement.value" class="form-control"
placeholder="Enter current lbs">
</div>
<button type="submit" value="Add" class="btn btn-
default">Add</button>
</form>
</div>
</div>
Thursday, September 26, 13
<button type="submit" value="Add" class="btn btn-
default">Add</button>
</form>
</div>
</div>
<div class="row">&nbsp;</div>
<div class="row">
<div class="col-md-6 col-xs-6 col-sm-6">
<table class='table table-striped table-bordered'>
<th>Weight (lbs)</th>
<th>DateTime</th>
<tr ng-repeat="weight_measurement in
weight_measurements">
<td>{{weight_measurement.value}}</td>
<td>{{weight_measurement.created_at}}</td>
</tr>
</table>
</div>
</div>
</div>
Thursday, September 26, 13
App.controller 'WeightMeasurementsCtrl', ['$scope',
"WeightMeasurement", ($scope, WeightMeasurement) ->
$scope.message = "Hey there, slim! Weigh in."
$scope.weight_measurements = WeightMeasurement.query()
$scope.addWeightMeasurement = ->
weight_measurement =
WeightMeasurement.save($scope.newWeightMeasurement)
$scope.weight_measurements.push(weight_measurement)
$scope.newWeightMeasurement = {}
]
Thursday, September 26, 13
Resources
• http://railscasts.com/episodes/405-angularjs
• http://yoosuf.me/blog/angularjs-beginners-guide/
• http://coderberry.me/blog/2013/04/23/angularjs-on-rails-4-part-2/
• http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-
application/
• https://github.com/Jaco-Pretorius/angular-rails/blob/master/app/assets/
javascripts/controllers/todo_controller.js
• http://angularjs.org/
Thursday, September 26, 13

Mais conteúdo relacionado

Mais procurados

Dla investor-presentation-march-2011
Dla investor-presentation-march-2011Dla investor-presentation-march-2011
Dla investor-presentation-march-2011
Delta_Apparel
 
Homework for french
Homework for frenchHomework for french
Homework for french
ka434306mhs
 

Mais procurados (17)

Friday Sermon 24 June 1983 - ایمان افروز خطبہ جمعہ فرمودہ حضرت مرزا طاہر احمد...
Friday Sermon 24 June 1983 - ایمان افروز خطبہ جمعہ فرمودہ حضرت مرزا طاہر احمد...Friday Sermon 24 June 1983 - ایمان افروز خطبہ جمعہ فرمودہ حضرت مرزا طاہر احمد...
Friday Sermon 24 June 1983 - ایمان افروز خطبہ جمعہ فرمودہ حضرت مرزا طاہر احمد...
 
Resume
ResumeResume
Resume
 
Organize your assets with Rails
Organize your assets with RailsOrganize your assets with Rails
Organize your assets with Rails
 
CSS Workflow. Pre & Post
CSS Workflow. Pre & PostCSS Workflow. Pre & Post
CSS Workflow. Pre & Post
 
Prism vol.98
Prism vol.98Prism vol.98
Prism vol.98
 
Dla investor-presentation-march-2011
Dla investor-presentation-march-2011Dla investor-presentation-march-2011
Dla investor-presentation-march-2011
 
Web Components: What, Why, How, and When
Web Components: What, Why, How, and WhenWeb Components: What, Why, How, and When
Web Components: What, Why, How, and When
 
El tractor
El tractorEl tractor
El tractor
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricks
 
Homework for french
Homework for frenchHomework for french
Homework for french
 
Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021
 
Elisa Carter BIO
Elisa Carter BIOElisa Carter BIO
Elisa Carter BIO
 
Munne ki laash
Munne ki laashMunne ki laash
Munne ki laash
 
Java Course Day 21
Java Course Day 21Java Course Day 21
Java Course Day 21
 
高専カンファレンス 014東京 予告編
高専カンファレンス 014東京 予告編高専カンファレンス 014東京 予告編
高専カンファレンス 014東京 予告編
 
Brunch With Coffee
Brunch With CoffeeBrunch With Coffee
Brunch With Coffee
 
Reasons To Love Ruby
Reasons To Love RubyReasons To Love Ruby
Reasons To Love Ruby
 

Destaque

mHealth regulations - Global efforts and readiness _White paper_DELL
mHealth regulations - Global efforts and readiness _White paper_DELLmHealth regulations - Global efforts and readiness _White paper_DELL
mHealth regulations - Global efforts and readiness _White paper_DELL
Sandesh Prabhu
 
Digital technologies are driving a new generation of telehealth_White paper_DELL
Digital technologies are driving a new generation of telehealth_White paper_DELLDigital technologies are driving a new generation of telehealth_White paper_DELL
Digital technologies are driving a new generation of telehealth_White paper_DELL
Sandesh Prabhu
 
Bizim canımız çağıl hocamıza gelsin
Bizim canımız çağıl hocamıza gelsinBizim canımız çağıl hocamıza gelsin
Bizim canımız çağıl hocamıza gelsin
Çağıl Kaya
 

Destaque (12)

An Intro to AngularJS
An Intro to AngularJSAn Intro to AngularJS
An Intro to AngularJS
 
Node and SocketIO
Node and SocketIONode and SocketIO
Node and SocketIO
 
PhoneGap - JavaScript for Mobile Apps
PhoneGap - JavaScript for Mobile AppsPhoneGap - JavaScript for Mobile Apps
PhoneGap - JavaScript for Mobile Apps
 
Underscore and Backbone Models
Underscore and Backbone ModelsUnderscore and Backbone Models
Underscore and Backbone Models
 
mHealth regulations - Global efforts and readiness _White paper_DELL
mHealth regulations - Global efforts and readiness _White paper_DELLmHealth regulations - Global efforts and readiness _White paper_DELL
mHealth regulations - Global efforts and readiness _White paper_DELL
 
Xerox mac
Xerox macXerox mac
Xerox mac
 
Digital technologies are driving a new generation of telehealth_White paper_DELL
Digital technologies are driving a new generation of telehealth_White paper_DELLDigital technologies are driving a new generation of telehealth_White paper_DELL
Digital technologies are driving a new generation of telehealth_White paper_DELL
 
Mycv
MycvMycv
Mycv
 
Bizim canımız çağıl hocamıza gelsin
Bizim canımız çağıl hocamıza gelsinBizim canımız çağıl hocamıza gelsin
Bizim canımız çağıl hocamıza gelsin
 
East 55th & Euclid Avenue Crossroads Study Images
East 55th & Euclid Avenue Crossroads Study ImagesEast 55th & Euclid Avenue Crossroads Study Images
East 55th & Euclid Avenue Crossroads Study Images
 
JavaScript State of the Union - Jan 2013
JavaScript State of the Union - Jan 2013JavaScript State of the Union - Jan 2013
JavaScript State of the Union - Jan 2013
 
Gok turks
Gok turksGok turks
Gok turks
 

Semelhante a A Rubyist Tries AngularJS

Time Travel - Predicting the Future and Surviving a Parallel Universe - JDC2012
Time Travel - Predicting the Future and Surviving a Parallel Universe - JDC2012 Time Travel - Predicting the Future and Surviving a Parallel Universe - JDC2012
Time Travel - Predicting the Future and Surviving a Parallel Universe - JDC2012
Hossam Karim
 
Evolving systems and the link to service orientation
Evolving systems and the link to service orientationEvolving systems and the link to service orientation
Evolving systems and the link to service orientation
Angelo van der Sijpt
 
CCM IDL, CORBA Component Model IDL
CCM IDL, CORBA Component Model IDLCCM IDL, CORBA Component Model IDL
CCM IDL, CORBA Component Model IDL
Emmanuel Fuchs
 
Social Media for Social Change
Social Media for Social ChangeSocial Media for Social Change
Social Media for Social Change
Sasha Gayatri
 
Julius Joseph-SAP BASIS Resume
Julius Joseph-SAP BASIS ResumeJulius Joseph-SAP BASIS Resume
Julius Joseph-SAP BASIS Resume
Julius Joseph
 

Semelhante a A Rubyist Tries AngularJS (20)

Time Travel - Predicting the Future and Surviving a Parallel Universe - JDC2012
Time Travel - Predicting the Future and Surviving a Parallel Universe - JDC2012 Time Travel - Predicting the Future and Surviving a Parallel Universe - JDC2012
Time Travel - Predicting the Future and Surviving a Parallel Universe - JDC2012
 
Evolving systems and the link to service orientation
Evolving systems and the link to service orientationEvolving systems and the link to service orientation
Evolving systems and the link to service orientation
 
דיני עבודה טמל 21.10.14דוד בן הרויה
דיני עבודה טמל 21.10.14דוד בן הרויהדיני עבודה טמל 21.10.14דוד בן הרויה
דיני עבודה טמל 21.10.14דוד בן הרויה
 
CCM IDL, CORBA Component Model IDL
CCM IDL, CORBA Component Model IDLCCM IDL, CORBA Component Model IDL
CCM IDL, CORBA Component Model IDL
 
AWS Elastic Beanstalk
AWS Elastic BeanstalkAWS Elastic Beanstalk
AWS Elastic Beanstalk
 
Device deployment
Device deploymentDevice deployment
Device deployment
 
WALA Tutorial at PLDI 2010
WALA Tutorial at PLDI 2010WALA Tutorial at PLDI 2010
WALA Tutorial at PLDI 2010
 
Apprentice Power-Point Presentation/What is Apprenticeship Recruitment
Apprentice Power-Point Presentation/What is Apprenticeship Recruitment Apprentice Power-Point Presentation/What is Apprenticeship Recruitment
Apprentice Power-Point Presentation/What is Apprenticeship Recruitment
 
Social Media for Social Change
Social Media for Social ChangeSocial Media for Social Change
Social Media for Social Change
 
Social Media for Social Change
Social Media for Social ChangeSocial Media for Social Change
Social Media for Social Change
 
All about Apache ACE
All about Apache ACEAll about Apache ACE
All about Apache ACE
 
Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021
 
Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021
 
Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021
 
Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021Tomar las riendas_de_la_vida-051021
Tomar las riendas_de_la_vida-051021
 
Cloud Readiness Index 2011 by the Asia Cloud Computing Association
Cloud Readiness Index 2011 by the Asia Cloud Computing AssociationCloud Readiness Index 2011 by the Asia Cloud Computing Association
Cloud Readiness Index 2011 by the Asia Cloud Computing Association
 
Improvement of defect record
Improvement of defect recordImprovement of defect record
Improvement of defect record
 
What you need to know about NGSOC. Presented at #CSXAsia #ScavengerHunt about...
What you need to know about NGSOC. Presented at #CSXAsia #ScavengerHunt about...What you need to know about NGSOC. Presented at #CSXAsia #ScavengerHunt about...
What you need to know about NGSOC. Presented at #CSXAsia #ScavengerHunt about...
 
Julius Joseph-SAP BASIS Resume
Julius Joseph-SAP BASIS ResumeJulius Joseph-SAP BASIS Resume
Julius Joseph-SAP BASIS Resume
 
The Even Darker Art of Rails Engines (2009)
The Even Darker Art of Rails Engines (2009)The Even Darker Art of Rails Engines (2009)
The Even Darker Art of Rails Engines (2009)
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

A Rubyist Tries AngularJS

  • 1. A Rubyist tries Angular Chase Southard KYJSUG | Sept. 2013 ~ a 5 day journey ~ Thursday, September 26, 13
  • 10. { sublime } Thursday, September 26, 13
  • 11. . !"" Gemfile !"" Gemfile.lock !"" README.rdoc !"" Rakefile !"" app #   !"" assets #   #   !"" images #   #   !"" javascripts #   #   #   !"" angular #   #   #   #   !"" controllers #   #   #   #   #   %"" weight_measurements_ctrl.js.coffee #   #   #   #   !"" directives #   #   #   #   %"" services #   #   #   #   %"" weight_measurement.js.coffee #   #   #   !"" app.js.coffee #   #   #   !"" application.js #   #   #   !"" home.js.coffee #   #   #   %"" weight_measurements.js.coffee #   #   %"" stylesheets #   #   !"" application.css #   #   !"" home.css.scss #   #   %"" weight_measurements.css.scss #   !"" controllers #   #   !"" application_controller.rb #   #   !"" concerns #   #   !"" home_controller.rb #   #   %"" weight_measurements_controller.rb #   !"" helpers #   #   !"" application_helper.rb #   #   !"" home_helper.rb #   #   %"" weight_measurements_helper.rb #   !"" mailers #   !"" models #   #   !"" concerns #   #   %"" weight_measurement.rb #   %"" views #   !"" home #   #   %"" index.html.erb #   !"" layouts #   #   %"" application.html.erb #   %"" weight_measurements !"" bin #   !"" bundle #   !"" rails #   %"" rake !"" bower_components #   %"" angular #   !"" angular.js #   !"" angular.min.js #   %"" bower.json !"" config #   !"" application.rb #   !"" boot.rb #   !"" database.yml #   !"" environment.rb #   !"" environments #   #   !"" development.rb #   #   !"" production.rb #   #   %"" test.rb #   !"" initializers #   #   !"" backtrace_silencers.rb #   #   !"" filter_parameter_logging.rb #   #   !"" inflections.rb #   #   !"" mime_types.rb #   #   !"" mime_types.rb #   #   !"" secret_token.rb #   #   !"" session_store.rb #   #   %"" wrap_parameters.rb #   !"" locales #   #   %"" en.yml #   %"" routes.rb !"" config.ru !"" db #   !"" development.sqlite3 #   !"" migrate #   #   %"" 20130923000919_create_weight_measurements.rb #   !"" schema.rb #   !"" seeds.rb #   %"" test.sqlite3 !"" lib #   !"" assets #   %"" tasks !"" log #   !"" development.log #   %"" test.log !"" public #   !"" 404.html #   !"" 422.html #   !"" 500.html #   !"" assets #   #   !"" application-1afffeb91436185f61c32d45639f5763.css #   #   !"" application-1afffeb91436185f61c32d45639f5763.css.gz #   #   !"" application-6b984b4c27cdb87e3c095018f44fa286.js #   #   !"" application-6b984b4c27cdb87e3c095018f44fa286.js.gz #   #   !"" application-9ace572d6e1deba06dd0c638399c3c2b.css #   #   !"" application-9ace572d6e1deba06dd0c638399c3c2b.css.gz #   #   %"" manifest-7b2fc84bf5424c2ee5d8cb0c099de0ae.json #   !"" favicon.ico #   %"" robots.txt !"" test #   !"" controllers #   #   !"" home_controller_test.rb #   #   %"" weight_measurements_controller_test.rb #   !"" fixtures #   #   %"" weight_measurements.yml #   !"" helpers #   #   !"" home_helper_test.rb #   #   %"" weight_measurements_helper_test.rb #   !"" integration #   #   %"" api_weight_measurements_test.rb #   !"" mailers #   !"" models #   #   %"" weight_measurement_test.rb #   %"" test_helper.rb !"" tmp #   %"" cache #   %"" assets #   %"" development #   !"" sass #   #   %"" 5587ef5cc6602d32d8b402dd40e027111957c1c9 #   #   !"" home.css.scssc #   #   %"" weight_measurements.css.scssc #   %"" sprockets #   !"" 01cb31ac38786ee5b727bfddccd0ad14 #   !"" 05d0795a34c03f1655eb8cfc49fb2eac #   !"" 07846260088cbe378436f5992acb85f2 #   !"" 0c9f5a68e10c76b2d39acc37bb242e22 #   !"" 0e780da7cd1c4685dc103ad4b341cc37 #   !"" 10c7635fffba778e532bfed7cc4afffa #   !"" 13fe41fee1fe35b49d145bcc06610705 Thursday, September 26, 13
  • 12. !"" app #   !"" assets #   #   !"" images #   #   !"" javascripts #   #   #   !"" angular #   #   #   #   !"" controllers #   #   #   #   #   %"" weight_measurements_ctrl.js.coffee #   #   #   #   !"" directives #   #   #   #   %"" services #   #   #   #   %"" weight_measurement.js.coffee #   #   #   !"" app.js.coffee #   #   #   !"" application.js #   #   #   !"" home.js.coffee #   #   #   %"" weight_measurements.js.coffee #   #   %"" stylesheets #   #   !"" application.css #   #   !"" home.css.scss #   #   %"" weight_measurements.css.scss Thursday, September 26, 13
  • 14. <div ng-controller="WeightMeasurementsCtrl"> <div class="row"> <div class="col-md-6 col-xs-6 col-sm-6"> <h1>{{message}}</h1> </div> </div> <div class="row"> <div class="col-md-6 col-xs-6 col-sm-6"> <form ng-submit="addWeightMeasurement()" class="form-inline" role="form"> <div class="form-group"> <input type="text" ng- model="newWeightMeasurement.value" class="form-control" placeholder="Enter current lbs"> </div> <button type="submit" value="Add" class="btn btn- default">Add</button> </form> </div> </div> Thursday, September 26, 13
  • 15. <button type="submit" value="Add" class="btn btn- default">Add</button> </form> </div> </div> <div class="row">&nbsp;</div> <div class="row"> <div class="col-md-6 col-xs-6 col-sm-6"> <table class='table table-striped table-bordered'> <th>Weight (lbs)</th> <th>DateTime</th> <tr ng-repeat="weight_measurement in weight_measurements"> <td>{{weight_measurement.value}}</td> <td>{{weight_measurement.created_at}}</td> </tr> </table> </div> </div> </div> Thursday, September 26, 13
  • 16. App.controller 'WeightMeasurementsCtrl', ['$scope', "WeightMeasurement", ($scope, WeightMeasurement) -> $scope.message = "Hey there, slim! Weigh in." $scope.weight_measurements = WeightMeasurement.query() $scope.addWeightMeasurement = -> weight_measurement = WeightMeasurement.save($scope.newWeightMeasurement) $scope.weight_measurements.push(weight_measurement) $scope.newWeightMeasurement = {} ] Thursday, September 26, 13
  • 17. Resources • http://railscasts.com/episodes/405-angularjs • http://yoosuf.me/blog/angularjs-beginners-guide/ • http://coderberry.me/blog/2013/04/23/angularjs-on-rails-4-part-2/ • http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4- application/ • https://github.com/Jaco-Pretorius/angular-rails/blob/master/app/assets/ javascripts/controllers/todo_controller.js • http://angularjs.org/ Thursday, September 26, 13