59
ngLessons K. Scott Allen @OdeToCode

DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 34: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Use Controller As

Explicit in the view

Simplifies tests

Page 36: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Avoid: $rootScope Abuse

Let’s store errors

Let’s store loading messages

Let’s store user profile

Let’s store configuration constants

Page 43: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Think About: Your Router

Look at UI-Router

Page 44: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Think About: A Better $http

BreezeJS

Restangular

Caching, configuration, offline…

Page 47: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Resolve Pros

View appears with data ready

Easier to stay somewhere is there is an error

Easier to test controllers

Page 51: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Think About: Authentication and

Authorization

Page 52: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Cookies or Tokens?

Cookies

Sent with every request

Susceptible to CSRF

Difficult to use across domains

Tokens

Offer more control, no forgeries

Work across domains

Require more code

Page 53: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Logins and Redirects

GET /secret redirect redirect GET /secret

Page 55: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Think About: Basic Abstractions

Controller

Model

Service

Directive

Filter

Page 57: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Think About: Directory Structure

I like feature based

Page 58: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

apps

movieApp

module.js

templates

specs

js

dashboard

common

Page 59: DEVintersection ASP.NET MVC & jQuery Mobilesddconf.com/brands/sdd/library/Lessons_From_A... · Title: DEVintersection ASP.NET MVC & jQuery Mobile Author: Scott Allen Subject: From

Summary

Error handling

Decorators, interceptors

Custom directives

Code style and structure