• Complain

Frederik Dietz - Recipes with Angular.js

Here you can read online Frederik Dietz - Recipes with Angular.js full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2013, publisher: leanpub.com, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    Recipes with Angular.js
  • Author:
  • Publisher:
    leanpub.com
  • Genre:
  • Year:
    2013
  • Rating:
    5 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 100
    • 1
    • 2
    • 3
    • 4
    • 5

Recipes with Angular.js: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Recipes with Angular.js" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Frederik Dietz: author's other books


Who wrote Recipes with Angular.js? Find out the surname, the name of the author of the book and a list of all author's works by series.

Recipes with Angular.js — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Recipes with Angular.js" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Recipes with Angularjs Practical concepts and techniques for rapid web - photo 1
Recipes with Angular.js
Practical concepts and techniques for rapid web application development
Frederik Dietz

This book is for sale at http://leanpub.com/recipes-with-angular-js

This version was published on 2013-08-10

This is a Leanpub book Leanpub empowers authors and publishers with - photo 2

* * * * *

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do.

* * * * *

2013 Frederik Dietz
Preface
Introduction

Angular.js is an open-source Javascript MVC (Model-View-Controller) framework developed by Google. It gives Javascript developers a highly structured approach to developing rich browser-based applications which, leads to very high productivity.

If you are using Angular.js, or considering it, this cookbook provides easy-to-follow recipes for issues you are likely to face. Each recipe solves a specific problem and provides a solution and in-depth discussion of it.

Code Examples

All code examples in this book can be found on Github.

How to contact me

If you have questions or comments please get in touch with:

Frederik Dietz (fdietz@gmail.com)

Acknowledgements

Special thanks go to my english editor and friend Robert William Smales!

Thanks go to John Lindquist for his excellent screencast project Egghead IO, Lukas Ruebbelke for his awesome videos, Matias Niemela for his great blog. And of course the whole development team behind Angular.js!

An Introduction to Angular.js
Including the Angular.js Library Code in an HTML Page
Problem

You wish to use Angular.js on a web page.

Solution

In order to get your first Angular.js app up and running you need to include the Angular Javascript file via script tag and make use of the ng-app directive.

123src="http://ajax.googleapis.com/ajax/libs/ 4 angularjs/1.0.4/angular.js"> 5 67ng-app>8

This is your first angular expression: {{ 1 + 2 }}

910
Picture 3

Tip: You can check out a complete example on github.

Discussion

Adding the ng-app directive tells Angular to kick in its magic. The expression {{ 1 + 2 }} is evaluated by Angular and the result 3 is rendered. Note that removing ng-app will result in the browser rendering the expression as is instead of evaluating it. Play around with the expression! You can, for instance, concatenate Strings and invert or combine Boolean values.

For reasons of brevity we will skip the boilerplate code in the following recipes.

Binding a Text Input to an Expression
Problem

You want user input to be used in another part of your HTML page.

Solution

Use Angulars ng-model directive to bind the text input to the expression.

1Enteryourname:<inputtype="text"ng-model="name"></</code>input>2<p>Hello{{name}}!</</code>p>

You can find the complete example on github.

Discussion

Assigning name to the ng-model attribute and using the name variable in an expression will keep both in sync automatically. Typing in the text input will automatically reflect these changes in the paragraph element below.

Consider how you would implement this traditionally using jQuery:

123src="http://code.jquery.com/jquery.min.js">456 Enter your name: type="text">7

id="name">

8910 $(document).ready(function() {11 $("input").keypress(function() {12 $("#name").text($(this).val());13 });14 });15161718

On document ready we bind to the keypress event in the text input and replace the text in the paragraph in the callback function. Using jQuery you need to deal with document ready callbacks, element selection, event binding and the context of this. Quite a lot of concepts to swallow and lines of code to maintain!

Responding to Click Events using Controllers
Problem

You wish to hide an HTML element on button click.

Solution

Use the ng-hide directive in conjunction with a controller to change the visibility status on button click.

123src="js/angular.js">4src="js/app.js">5rel="stylesheet"href="css/bootstrap.css">67ng-app>8
ng-controller="MyCtrl">9ng-click="toggle()">Toggle10

ng-show="visible">Hello World!

11
1213

And the controller in js/app.js:

1functionMyCtrl($scope){2$scope.visible=true;34$scope.toggle=function(){5$scope.visible=!$scope.visible;6};7}

You can find the complete example on github.

When toggling the button the Hello World paragraph will change its visibility.

Discussion

Using the ng-controller directive, we bind the

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Recipes with Angular.js»

Look at similar books to Recipes with Angular.js. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Recipes with Angular.js»

Discussion, reviews of the book Recipes with Angular.js and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.