angular-ifying your visualforce pages
TRANSCRIPT
Angular-ifying your Visualforce pages
Abhinav Gupta @abhinavguptas
Bringing productivity and fun of web development into Visualforce pages.
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Safe Harbor
Salesforce MVP (5x) & Architect
Founder of Concretio Apps
@abhinavguptas
Speakers
Angular app structuring, industry standard guidelines from
Google’s Angular style guide.
Ionic template apps.
Angular App Structuring in “Salesforce” reviewed in 4 approaches with pros/cons.
Approach 1: Using couple of static resources and supporting VF pages per SPA.
Approach 2: Mavensmate resource bundles.
Approach 3: Aside.io zipped resource editing.
Approach 4: Welkin Suite zipped resource editing.
Live demos of above approaches in a Salesforce org.
Agenda
Angular App Structuring How web in general understands Angular app structure
App structure for simple app with 1 directive and 1 service. sampleapp
├── app.css
├── app.js
├── app-controller.js
├── app-controller_test.js
├── components
│ └── foo
│ ├── foo.js
│ ├── foo-directive.js
│ ├── foo-directive_test.js
│ ├── foo-service_test.js
│ ├── foo-service_test.js
├── index.html
Google’s Angular Style Guide http://google.github.io/styleguide/angularjs-google-style.html
App structure when service and directive are unrelated sampleapp
├── app.css
├── app.js
├── app-controller.js
├── app-controller_test.js
├── components
│ └── foo
│ ├── foo.js
│ ├── foo-directive.js
│ ├── foo-directive_test.js
│ └── bar
│ ├── bar.js
│ ├── bar-directive.js
│ ├── bar-directive_test.js
├── index.html
Google’s Angular Style Guide http://google.github.io/styleguide/angularjs-google-style.html
Ionic’s structure for a sample “Tabs” app http://ionicframework.com/getting-started/ How it looks ├── css │ └── style.css ├── img │ └── ionic.png ├── index.html ├── js │ ├── app.js │ ├── controllers.js │ └── services.js ├── lib │ └── ionic │ ├── …(ionic dist) └── templates ├── chat-detail.html ├── tab-account.html ├── tab-chats.html ├── tab-dash.html └── tabs.html
Angular multi tabs SPA in
“Salesforce” A simple tasks and events management app
For quick glimpse and management of tasks and events.
Built using Angular and Ionic (UI)
Single Page app
Multiple tabs, like Dashboard, Tasks & Events
App Overview
App Demo
Angular App Structuring in
“Salesforce” How to port generalised ng app structures to visualforce pages ?
├── classes
│ ├── RemoteTKController.cls
│ ├── TestRemoteTKController.cls
├── components
│ ├── RemoteTK.component
└── staticresources
├── ioniclib.resource
Shared Metadata
Approach 1 - Using multiple static resources and pages https://developer.salesforce.com/blogs/developer-relations/2014/04/building-beautiful-mobile-apps-in-visualforce-using-angularjs-and-ionic-part-1.html
Raja Rao DV Developer Advocate @salesforce @rajaraodv
Very good series of blogs with videos on creating SPAs in VF
4 partial VF pages & 3 additional static resources needed for a simple app
├── pages
│ ├── myapp_index_html.page
│ ├── myapp_tab_dash_html.page
│ ├── myapp_tab_events_html.page
│ ├── myapp_tab_tasks_html.page
│ ├── myapp_tabs_html.page
└── staticresources
├── myapp_app_js.resource
├── myapp_controllers_js.resource
├── myapp_services_js.resource
Approach 1 - App Structure
Live demos
Live illustration of Approach 1 Angular app in a Salesforce Org.
Approach 1 Review - GOOD & BAD parts
GOOD
Good for prototyping at rapid pace.
Less Conflicts: In case, multiple developers
are working on different views of the same
page.
BAD
Performance could be slow, because HTML
templates are loading from VF pages.
Grouping of related files is based on filename,
no clear structure.
Too much scattered metadata, when multiple
SPAs exists in a single Org, i.e. 5 extra pages
and 3 static resources for a single VF page.
Approach 2 - MavensMate Resource Bundles http://mavensmate.com/ http://www.joe-ferraro.com/2012/12/mavensmate-resource-bundles/
Approach 2 - App Structure
Maven’s ResourceBundle offering exploded directory structure for StaticResource “tabs_app_mavens”
├── resource-bundles
│ └── tabs_app_mavens.resource
│ ├── css
│ ├── img
│ ├── js
│ │ ├── app.js
│ │ ├── controllers.js
│ │ └── services.js
│ └── templates
│ ├── tab-dash.html
│ ├── tab-events.html
│ ├── tab-tasks.html
│ └── tabs.html
Just 1 StaticResource for partials, styles and scripts
├── pages
│ ├── tabs_app_mavens.page
└── staticresources
├── tabs_app_mavens.resource
Live demos
Live illustration of Approach 2 Angular app in a Salesforce Org.
Approach 2 - GOOD & BAD parts
GOOD
Familiar structure for new web developers
to productively code Angular apps in
Salesforce.
Limited metadata per VF page and SPA.
BAD
File conflicts when multiple developers
working on different views of same VF page or
SPA.
Mavensmate save speeds are slow at times,
which might be a big turn down. Aside.IO wins
here by huge margin.
Approach 3 - Aside.IO zipped static resources https://www.aside.io/
Quite similar to Mavens, but all browser based tabs_app_aside.resource
├── css
├── js
│ ├── app.js
│ ├── controller.js
│ └── services.js
└── templates
├── tab-dash.html
├── tab-events.html
├── tab-tasks.html
└── tabs.html
Approach 3 - App Structure
Just 1 StaticResource for partials, styles and scripts
├── pages
│ ├── tabs_app_aside.page
└── staticresources
├── tabs_app_aside.resource
Live demos
Live illustration of Approach 3 Angular app in a Salesforce Org.
BAD
Not able to save any file in zip apart from js,
css, txt and html
File conflicts when multiple developers
working on different views of same VF page or
SPA.
Approach 3 - GOOD & BAD parts
GOOD
Blazing fast SAVE speeds (biggest
advantage).
Some what familiar structure for new web
developers to productively code Angular
apps in Salesforce.
Limited metadata per VF page and SPA.
Approach 4 - Welkin Suite (Windows Users Only) http://welkinsuite.com/
Approach 4 - App Structure
Similar to MavensMate, could be nice option for VisualStudio lovers
Questions ? Happy to answer any related queries later via twitter @abhinavguptas
Session Code Samples https://github.com/abhinavguptas/Dreamforce-2015-Session-Angular-ifying-your-Visualforce-pages
Raja Rao’s Salesforce Blog https://developer.salesforce.com/blogs/developer-relations/2014/04/building-beautiful-mobile-apps-in-visualforce-using-angularjs-and-ionic-part-1.html
Google Angular Style Guide http://google.github.io/styleguide/angularjs-google-style.html
MavensMate IDE http://mavensmate.com/
Using MavensMate Resource Bundle http://www.joe-ferraro.com/2012/12/mavensmate-resource-bundles/
ASIDE IDE https://www.aside.io/
Welkin Suite IDE http://welkinsuite.com/
Resources
Source: placeholder
Thank you