From 2249a5f79ff44773f6e1774028861e130d8fe77f Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Thu, 2 Nov 2017 16:02:24 +0530 Subject: Integrated Template loading using html-loader --- src/myview.js | 5 +++-- src/views/template.html | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 src/views/template.html (limited to 'src') diff --git a/src/myview.js b/src/myview.js index d5c0484..a7e9c23 100644 --- a/src/myview.js +++ b/src/myview.js @@ -4,7 +4,7 @@ import $ from 'jquery'; import Mustache from 'mustache'; import axios from 'axios'; import Http from './http'; - +import template from './views/template.html'; export default class MyView extends Backbone.View { @@ -14,6 +14,7 @@ export default class MyView extends Backbone.View { initialize() { this.el = '#myarea'; + console.log(template); this.$el = $(this.el); this.template = 'Hello'; Http.service.get('olapa') @@ -28,7 +29,7 @@ export default class MyView extends Backbone.View { } render() { - this.$el.html(Mustache.render(this.template)); + this.$el.html(Mustache.render(template,{data:'This is a sample. sdfhd'})); } diff --git a/src/views/template.html b/src/views/template.html new file mode 100644 index 0000000..fe73372 --- /dev/null +++ b/src/views/template.html @@ -0,0 +1 @@ + -- cgit v1.2.3