author avepoint meetings senior product marketing manager – office

70

Upload: donald-davis

Post on 19-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Author AvePoint Meetings Senior Product Marketing Manager – Office
Page 2: Author AvePoint Meetings Senior Product Marketing Manager – Office

Jeremy ThakeSenior Marketing Manager – Office Division

SharePoint 2013 Apps with AngularJS

2-570

Page 3: Author AvePoint Meetings Senior Product Marketing Manager – Office

Speaker

Jeremy Thake

Author

AvePoint Meetings

Senior Product Marketing Manager – Office

@jthake www.jeremythake.com

Page 4: Author AvePoint Meetings Senior Product Marketing Manager – Office

Why AngularJSIntro to AngularJSGetting Started In SharePointCompleteMe AppTips & Tricks

Agenda

Page 5: Author AvePoint Meetings Senior Product Marketing Manager – Office

Why AngularJS

Page 6: Author AvePoint Meetings Senior Product Marketing Manager – Office
Page 7: Author AvePoint Meetings Senior Product Marketing Manager – Office

Jan 2010

Page 8: Author AvePoint Meetings Senior Product Marketing Manager – Office

~600 contributors~2,500 PRs

Community

Page 9: Author AvePoint Meetings Senior Product Marketing Manager – Office

14 Core

Page 10: Author AvePoint Meetings Senior Product Marketing Manager – Office

thinkster

Page 11: Author AvePoint Meetings Senior Product Marketing Manager – Office
Page 12: Author AvePoint Meetings Senior Product Marketing Manager – Office

Trend: 2009-2013

Page 13: Author AvePoint Meetings Senior Product Marketing Manager – Office
Page 14: Author AvePoint Meetings Senior Product Marketing Manager – Office

3 weeks

with Angular

1,500 LOC

6 monthsx 3 devs

Before

17,000 LOC

feedback

Page 15: Author AvePoint Meetings Senior Product Marketing Manager – Office

Handles the DOM and AJAX glue

Page 16: Author AvePoint Meetings Senior Product Marketing Manager – Office

Well defined structure

Page 17: Author AvePoint Meetings Senior Product Marketing Manager – Office

Everything to build a CRUD app

Page 18: Author AvePoint Meetings Senior Product Marketing Manager – Office

Testable

Page 19: Author AvePoint Meetings Senior Product Marketing Manager – Office

Model View …

http://docs.angularjs.org/guide/concepts

Page 20: Author AvePoint Meetings Senior Product Marketing Manager – Office

Intro to AngularJS

Page 21: Author AvePoint Meetings Senior Product Marketing Manager – Office

<html ng-app>

<head> <script src="lib/angular/angular.js"></script></head>

Basics

Page 22: Author AvePoint Meetings Senior Product Marketing Manager – Office

Data Binding

http://docs.angularjs.org/guide/databinding

Page 23: Author AvePoint Meetings Senior Product Marketing Manager – Office

<li>NO of phones: {{ phones.length }}</li>

Data Binding

Page 24: Author AvePoint Meetings Senior Product Marketing Manager – Office

var myApp = angular.module('myApp', []);

Modules

Page 25: Author AvePoint Meetings Senior Product Marketing Manager – Office

function PhoneListCtrl($scope) {

Scope

$scope.phones = [ {"name": "Nexus S", "snippet": "Fast just got faster with Nexus S."}, {"name": "Motorola XOOM™ with Wi-Fi”}

];}

Page 26: Author AvePoint Meetings Senior Product Marketing Manager – Office

<body ng-controller="PhoneListCtrl">

<ul> <li ng-repeat="phone in phones"> {{phone.name}} <p>{{phone.snippet}}</p> </li></ul>

Controllers

Page 27: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:Angular 101

http://jsfiddle.net/jthake/2RPr5/

Page 28: Author AvePoint Meetings Senior Product Marketing Manager – Office

<edit-in-place value="contact.name"></edit-in-place>

Directives

app.directive( 'editInPlace', function() {

Page 29: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO: Inline Editing Directivehttp://jsfiddle.net/jthake/TVF5K/

Page 30: Author AvePoint Meetings Senior Product Marketing Manager – Office

myApp.service('helloWorldFromService', function () { this.sayHello = function () { return "Hello, World!" };});

Defining Services

Page 31: Author AvePoint Meetings Senior Product Marketing Manager – Office

function MyCtrl($scope, helloWorldFromService) { $scope.hellos = [helloWorldFromService.sayHello()];}

Calling Services

Page 32: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:Services, Factories, Providershttp://jsfiddle.net/jthake/Vb4Bb/

Page 33: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:Todo App

http://jsfiddle.net/jthake/Mvk4B/

Page 34: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:Broadcasting

http://jsfiddle.net/jthake/35KTY/

Page 35: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:Animation

http://jsfiddle.net/simpulton/EMA5X/

Page 36: Author AvePoint Meetings Senior Product Marketing Manager – Office

Getting StartedIn SharePoint

Page 37: Author AvePoint Meetings Senior Product Marketing Manager – Office

<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">

<div ng-app="myApp">

Different Setup

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>

Page 38: Author AvePoint Meetings Senior Product Marketing Manager – Office

CompleteMe

Page 39: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:Intro to CompleteMe App

Page 40: Author AvePoint Meetings Senior Product Marketing Manager – Office

Controllers

Page 41: Author AvePoint Meetings Senior Product Marketing Manager – Office

myApp.controller('TodoCtrl', function TodoCtrl($scope, SharePointJSOMService) {

Minification

myApp.controller('TodoCtrl', ['$scope', 'SharePointJSOMService', function ($scope, SharePointJSOMService) {

Page 42: Author AvePoint Meetings Senior Product Marketing Manager – Office

App.directive('load', function() {return { replace: true, restrict: 'E', templateUrl: "inc/header.html"};

Directive inline template workarounds

Page 43: Author AvePoint Meetings Senior Product Marketing Manager – Office

template: '<div ng-hide="isDeleted">' + ' <div class="col-md-12 col-xs-12" ng-show="editMode" >' + ' <form class="form-inline" role="form">' + ' <div class="checkbox">' +

Directive inline template workarounds

Page 44: Author AvePoint Meetings Senior Product Marketing Manager – Office

compile: function (tElement, tAttrs) { JSRequest.EnsureSetup(); hostweburl = decodeURIComponent(JSRequest.QueryString["SPHostUrl"]); var siteUrl = hostweburl; var tplURL = siteUrl + '/Complete%20Me/Pages/template.html';

Directive compile workarounds

Page 45: Author AvePoint Meetings Senior Product Marketing Manager – Office

return { pre: function preLink(scope, iElement, iAttrs, controller) { templateLoader.then(function (templateText) { iElement.html($compile(tElement.html())(scope)); }); var previousValue;

scope.edit = function () {

Can’t use link: function in directive

Page 46: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:CompleteMe Controllers

Page 47: Author AvePoint Meetings Senior Product Marketing Manager – Office

Services

Page 48: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:CompleteMe SharePoint Services

Page 49: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:CompleteMe Dependency Injection

Page 50: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:CompleteMe Automated Testing

Page 51: Author AvePoint Meetings Senior Product Marketing Manager – Office

TIPs n TRICKS

Page 52: Author AvePoint Meetings Senior Product Marketing Manager – Office

1. UI Bootstrap

Page 53: Author AvePoint Meetings Senior Product Marketing Manager – Office

Grid Layout

Page 54: Author AvePoint Meetings Senior Product Marketing Manager – Office

Forms

Page 55: Author AvePoint Meetings Senior Product Marketing Manager – Office

Controls

Page 56: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:CompleteMe Responsive UI

Page 57: Author AvePoint Meetings Senior Product Marketing Manager – Office

2. Responsive App Part

Page 58: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:CompleteMe App Part

Page 59: Author AvePoint Meetings Senior Product Marketing Manager – Office

3. People Picker

Page 60: Author AvePoint Meetings Senior Product Marketing Manager – Office

People Picker Control

http://code.msdn.microsoft.com/office/SharePoint-2013-Add-the-900e0742

Page 61: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:People Picker

Page 62: Author AvePoint Meetings Senior Product Marketing Manager – Office

4. moment.js

Page 63: Author AvePoint Meetings Senior Product Marketing Manager – Office

DEMO:moment.js

Page 64: Author AvePoint Meetings Senior Product Marketing Manager – Office

5. Visual Studio Online

Page 65: Author AvePoint Meetings Senior Product Marketing Manager – Office

Wrapping up

Page 66: Author AvePoint Meetings Senior Product Marketing Manager – Office

What did we learn?Why AngularJSIntro to AngularJSGetting Started In SharePointCompleteMe AppTips & Tricks

Page 67: Author AvePoint Meetings Senior Product Marketing Manager – Office

Next StepsCheck out ng-conf for AngularJS training contentInvestigate CompleteMe source codeTrack my RSS feed

Page 68: Author AvePoint Meetings Senior Product Marketing Manager – Office

Explore our new Preview APIs

In-depth articles on MSDNSubject to change; not for production use

Connect with the community

Speak your mind at OfficeSPDev.UserVoice.ComSolve your roadblocks on StackOverflow

[Office] and [SharePoint]

Build using our toolsUnleash your development skills with Office Dev Tools for Visual Studio 2013 and Office 365 API Tools for Visual Studio 2013

Calls to Action

Page 69: Author AvePoint Meetings Senior Product Marketing Manager – Office

Your Feedback is Important

Fill out an evaluation of this session and help shape future events.

Scan the QR code to evaluate this session on your mobile device.

You’ll also be entered into a daily prize drawing!

Page 70: Author AvePoint Meetings Senior Product Marketing Manager – Office

© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.