You are previewing AngularJS for .NET Developers in 24 Hours, Sams Teach Yourself.
O'Reilly logo
AngularJS for .NET Developers in 24 Hours, Sams Teach Yourself

Book Description

AngularJS has skyrocketed to immense popularity as the #1 modern JavaScript framework for rapid web application development. Increasingly, Microsoft developers want to discover all that it can do for them. Now, there's a complete introduction to AngularJS that helps you build on your existing .NET knowledge to flatten the AngularJS learning curve and quickly master today's best practices for AngularJS development. In just 24 lessons of one hour or less, Sams Teach Yourself AngularJS for .NET Developers in 24 Hours will help you leverage AngularJS's remarkable power to streamline practically any web development project. Each short, easy lesson builds on all that's come before, guiding you smoothly to mastery. The authors cover all this, and much more:

  • Comparing AngularJS with .NET, and discovering how they can work together

  • Understanding core AngularJS concepts through the lens of a .NET developer

  • Mastering Visual Studio 2015 front-end development tools and high-productivity workflows

  • Discovering key JavaScript design patterns that support AngularJS (and their similarities to C#)

  • Using AngularJS modules, controllers, views, databinding, and event handling

  • Implementing AngularJS services

  • Working with directives, custom directives and dependency injection

  • Setting up AngularJS routing

  • Best practice strategies for organizing AngularJS applications

  • Sophisticated AngularJS techniques, including filters, advanced patterns, and communication between controllers

  • Preparing to deploy your code

  • Deploying AngularJS code to the Microsoft Azure cloud

  • Testing and debugging

  • Integrating Angular .JS with .NET Web Forms and .NET MVC

  • Using WebAPI to build REST APIs in .NET and consume their services in AngularJS

  • Combining AngularJS with .NET SignalR to build real-time web apps

  • Extending AngularJS development with bower, gulp, and webstorm

  • Previewing the future of AngularJS

  • Throughout, step-by-step instructions walk you through common questions, issues, and tasks; Q-and-As, Quizzes, and Exercises build and test your knowledge; "Did You Know?" tips offer insider advice and shortcuts; and "Watch Out!" alerts help you avoid problems. By the time you're finished, you'll have all the skills and code you'll need to supercharge web development with AngularJS -- whether you're building from scratch, or integrating with existing .NET code.

    Table of Contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Contents at a Glance
    5. Table of Contents
    6. About the Authors
    7. Dedications
    8. Acknowledgments
    9. We Want to Hear from You!
    10. Reader Services
    11. Introduction
      1. Audience and Organization
      2. How This Book Is Organized
      3. Conventions Used in This Book
      4. Exercises
      5. Onward and Upward!
    12. Hour 1. Introducing Modern Front-End Development
      1. Why Does Everything Look So Different?
      2. How Is the Code Different?
      3. Options for Front-End Development
        1. Backbone.js
        2. Ember.js
        3. AngularJS
      4. Why Angular?
      5. Why Is Angular 1 Still Relevant?
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Answers
      9. Exercise
    13. Hour 2. Presenting JavaScript Patterns
      1. Five JavaScript Tips and Tricks
        1. JavaScript Is Loosely Typed
        2. Functions Are Just Objects
        3. JavaScript Uses Function Scoping Instead of Block Scoping
        4. Equality and ===
        5. Function Overloading Isn’t Really a Thing
      2. JavaScript Patterns
        1. Closures
        2. Revealing Module Pattern
        3. IIFE
        4. Promises
        5. Pub/Sub
        6. MV*
          1. Model
          2. View
          3. Whatever’s and *’s
      3. Summary
      4. Q&A
      5. Workshop
        1. Quiz
        2. Answers
      6. Exercise
    14. Hour 3. Tinkering with Tools for Modern Front-End Development
      1. The Tool Landscape
      2. Node
      3. Package Management
        1. NPM
        2. Bower
        3. Grunt
        4. Yeoman
      4. Summary
      5. Q&A
      6. Workshop
        1. Quiz
        2. Answers
      7. Exercise
    15. Hour 4. Mastering Modules
      1. Angular Modules
      2. Creating Modules
      3. Summary
      4. Q&A
      5. Workshop
        1. Quiz
        2. Answers
      6. Exercise
    16. Hour 5. Covering Controllers
      1. Angular Controllers
      2. $scope
      3. Controller Inheritance
      4. What Should and Shouldn’t Go into a Controller
      5. Best Practices
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Answers
      9. Exercise
    17. Hour 6. Understanding Views, Data Binding, and Event Handling
      1. Angular Views
      2. Data Binding
      3. Two-Way Data Binding with ng-model
      4. Data Binding Performance
      5. Multiple Controllers in a View
      6. Multiple Templates
      7. Angular Event Binding
      8. View Best Practices
        1. Template File Organization
        2. Element Attributes
        3. Hiding a Template’s Raw Content
      9. Summary
      10. Q&A
      11. Workshop
        1. Quiz
        2. Answers
      12. Exercise
    18. Hour 7. Discovering Services: Part I
      1. Angular Services
      2. Service Versus Factory
        1. Value Versus Constant
        2. Providers
      3. Using Services
      4. Summary
      5. Q&A
      6. Workshop
        1. Quiz
        2. Answers
      7. Exercise
    19. Hour 8. Discovering Services: Part II
      1. Using Services for a DAL
      2. Promises and $q
      3. Summary
      4. Q&A
      5. Workshop
        1. Quiz
        2. Answers
      6. Exercise
    20. Hour 9. Using Built-In Directives
      1. Angular Directives
      2. Built-In Angular Directives
        1. ng-hide and ng-show
        2. ng-if
        3. ng-class
        4. ng-repeat
        5. ng-click
        6. ng-model
      3. Summary
      4. Q&A
      5. Workshop
        1. Quiz
        2. Answers
      6. Exercise
    21. Hour 10. Conquering Custom Directives
      1. Why Custom Directives?
      2. Link Function
        1. DOM Manipulation
      3. Directive Scope
      4. Element Versus Attribute
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Answers
      8. Exercise
    22. Hour 11. Depending on Dependency Injection
      1. Inversion of Control and Dependency Injection
      2. Dependency Injection in .NET
        1. The Case for DI on the Front End
      3. Using Angular’s DI
        1. Implicit Annotation
        2. Inline Array Annotation
        3. $inject Property Annotation
      4. Summary
      5. Q&A
      6. Workshop
        1. Quiz
        2. Answers
      7. Exercise
    23. Hour 12. Rationalizing Routing
      1. Routing in a Single-Page App
      2. Setting Up Routing with Angular
      3. Cleaning Up Your URLs with HTML5 Mode
      4. Executing Code Before a Route Change with a Resolve
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Answers
      8. Exercise
    24. Hour 13. Actualizing Application Organization
      1. Angular in a Single File
      2. Breaking Your Application into Separate Files
      3. Organizing Your Application by File Type
      4. Organizing Your Application by Feature
      5. Application Pro Tips
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Answers
      9. Exercise
    25. Hour 14. Figuring Out Filters
      1. Examples of Formatting with Built-In Angular Filters
        1. String Casing
        2. Dates
        3. Currencies
      2. Create Your Own Angular Filter
        1. A Better Capitalization Filter
        2. A Better Date Filter
        3. A Better Currency Filter
      3. Using a Filter to Search on ng-repeat
      4. Summary
      5. Q&A
      6. Workshop
        1. Quiz
        2. Answers
      7. Exercise
    26. Hour 15. Approaching Angular Patterns
      1. Design Patterns
      2. Controller Patterns and Principles
      3. Service Patterns and Principles
      4. Angular Architecture Patterns
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Answers
      8. Exercise
    27. Hour 16. Making Components Communicate
      1. Communication Between Components
      2. Calling Directive Functions from a Controller
      3. Using $watch to Communicate
      4. Using Events to Communicate
      5. Nested Controller Communication
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Answers
      9. Exercise
    28. Hour 17. Demonstrating Deployment
      1. Automating Deployment Tasks
      2. Writing Production-Ready Angular Code
        1. IIFEs
        2. Use Strict
      3. Error-Checking Your Angular Code
        1. JSLint
        2. JSHint
      4. Minifying and Concatenating Your Angular Code
      5. Deploying Your Angular Code to Microsoft Azure
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Answers
      9. Exercise
    29. Hour 18. Unraveling Unit Tests
      1. Unit Testing in Angular
      2. Karma and Jasmine
      3. Getting Everything Set Up
      4. Testing Controllers
      5. Testing Services
      6. Testing Directives
      7. Summary
      8. Q&A
      9. Workshop
        1. Quiz
        2. Answers
      10. Exercise
    30. Hour 19. Destroying Debugging
      1. Debugging Strategies and Tips
      2. Tools
        1. Google Chrome Developer Tools
        2. Firefox Toolbox and Firefox Developer Edition
        3. Internet Explorer Developer Tools
        4. Batarang Chrome Extension
      3. Summary
      4. Q&A
      5. Workshop
        1. Quiz
        2. Answers
      6. Exercise
    31. Hour 20. Applying Angular to ASP.NET Web Forms
      1. Strategies for Modernizing Web Applications
      2. Translating Web Forms into Angular
        1. Building Out a Web Forms Example
        2. Changing Web Forms Functionality to Angular
      3. Augment Web Forms with Angular
      4. Summary
      5. Q&A
      6. Workshop
        1. Quiz
        2. Answers
      7. Exercise
    32. Hour 21. Applying Angular to ASP.NET MVC
      1. Building a Sample ASP.NET MVC App
      2. Adding Angular to an ASP.NET MVC App
      3. Summary
      4. Q&A
      5. Workshop
        1. Quiz
        2. Answers
      6. Exercise
    33. Hour 22. Using Angular with ASP.NET Web API
      1. Single-Page Apps with Angular and Web API
      2. Creating a Simple Web API
        1. Testing Your API
        2. Deploying Your API
      3. Consuming the Web API in Angular
        1. CORS
        2. Writing Services
          1. Section 1: Viewing Artists
          2. Section 2: Adding a New Artist
          3. Section 3: Editing an Artist
      4. Consuming Other APIs with Angular
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Answers
      8. Exercise
    34. Hour 23. Using Angular with ASP.NET SignalR
      1. When Should You Use SignalR?
      2. Configuring SignalR
      3. Adding SignalR to the OWIN Pipeline
      4. Sending SignalR Messages in Your API
      5. Receiving SignalR Messages in Angular
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Answers
      9. Exercise
    35. Hour 24. Focus on the Future
      1. What’s the Current Status of Angular?
      2. What’s Changing in Angular 2?
      3. How Can You Prepare for Angular 2?
        1. Use the New Component Router (When It’s Ready)
        2. Use ControllerAs Syntax
        3. Learn TypeScript
      4. ES6
      5. Web Components
      6. Why the First 23 Hours of This Book Are More Important Than This Last Hour
      7. Summary
      8. Q&A
      9. Workshop
        1. Quiz
        2. Answers
      10. Exercise
    36. Index