Matteo Scandolo | ef96992 | 2016-08-11 13:49:12 -0700 | [diff] [blame] | 1 | (function () { |
| 2 | 'use strict'; |
| 3 | angular.module('xos.UITutorial') |
| 4 | .service('TemplateHandler', function(_){ |
| 5 | |
| 6 | this.error = _.template(`<span class="error">[ERROR] <%= msg %></span>`); |
| 7 | |
| 8 | this.instructions = _.template(` |
| 9 | <div> |
| 10 | <strong><%= title %></strong> |
| 11 | <% _.forEach(messages, function(m) { %><p><%= m %></p><% }); %> |
| 12 | </div> |
| 13 | `); |
| 14 | |
| 15 | this.resourcesResponse = _.template(` |
| 16 | <div> |
| 17 | <p>Corresponding js code: <code><%= jsCode %></code></p> |
| 18 | <div class="json"><%= res %></div> |
| 19 | </div> |
| 20 | `); |
| 21 | |
| 22 | this.jsonObject = _.template(`<div class="jsonObject"><%= JSON.stringify(obj) %><%=comma%></code></div>`); |
| 23 | |
| 24 | this.jsonCollection = _.template(`<div class="jsonCollection">[<% _.forEach(collection, function(item) { %><%= item %><%}); %>]</div>`); |
| 25 | }); |
| 26 | })(); |