knockout.js - How to Include text/html Scripts with Hot Towel -
I'm trying to familiarize myself with a hot towel SPA template. I would like to apply inline editing after reading from Ryan Wanderpole.
Now I am in quite a disadvantage as to the script block of section content, 'script / text' is included.
This is in the section for my perspective (note inside two script blocks).
& lt; Section & gt; & Lt; H2 class = "page-title" data-bind = "text: title" & gt; & Lt; / H2 & gt; & Lt; Table class = "table-table-striped table-limit" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th & gt; Id & lt; / Th & gt; & Lt; Th & gt; Company name & lt; / Th & gt; & Lt; Th & gt; Last name & lt; / Th & gt; & Lt; Th & gt; First name & lt; / Th & gt; & Lt; Th style = "width: 50px; text-line: true;" / & Gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody data-bind = "template: {name: templatetouse, foreign language: customer}" & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; Script id = "readTemplate" type = "text / html" & gt; & Lt; TR & gt; & Lt; Td data-bind = 'value: customer id' & gt; & Lt; / Td> & Lt; Td data-bind = 'value: company name' & gt; & Lt; / Td> & Lt; Td data-bind = 'value: last name' & gt; & Lt; / Td> & Lt; Td data-bind = 'value: first name' & gt; & Lt; / Td> & Lt; Td square = "button" & gt; & Lt; A class = "btn" data-bind = "click: edit" href = "#" headline = "edit" & gt; & Lt; I class = "icon-edit" & gt; & Lt; / I & gt; & Lt; / A & gt; & Lt; A class = "btn" data-bind = "click: delete customer" href = "#" title = "remove" & gt; & Lt; I class = "icon-remove" & gt; & Lt; / I & gt; & Lt; / A & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Script & gt; & Lt; Script id = "editTemplate" type = "text / html" & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input Data-Bind = 'Value: Customer ID' / & gt; & Lt; / Td> & Lt; Td> & Lt; Input data-bind = 'value: company name' / & gt; & Lt; / Td> & Lt; Td> & Lt; Input Data-Bind = 'Value: Last Name' / & gt; & Lt; / Td> & Lt; Td> & Lt; Input data-bind = 'value: first name' / & gt; & Lt; / Td> & Lt; Td square = "button" & gt; & Lt; A class = "btn btn-success" data-bind = "click: save" href = "#" title = "save" & gt; & Lt; I class = "icon-fine" & gt; & Lt; / I & gt; & Lt; / A & gt; & Lt; A class = "btn" data-bind = "click: cancel" href = "#" headline = "cancel" & gt; & Lt; I class = "icon-trash" & gt; & Lt; / I & gt; & Lt; / A & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Script & gt; & Lt; / Section & gt; And this is my visual model.
define (['service / logger'], function (logger) {function customer (data) {var self = this; self.customer id = .horsabel (Data Customer Id); Self.companyname = CO.Obsubable (Data CompanName); self.listname = to.horbable (data.listname); self; first name = CO.obsubberl (data first name);} function view modal () {var self = This; self.title = 'Customer'; self.customers = ko.observableArray ([]); self.selectedItem = ko.observable (); edit itself = edit (function) Insam) {self.selectedItem (item);}; self.cancel = function () {self.selectedItem (null);}; self.removeCustomer = function (customer) {// code to delete the line} .ave = Function () {// code to save changes}; self.templateToUse = function (item) {return self.selectedItem () === item? 'EditTemplate': 'readTemplate';}}} var vm = see new modell (); Return vm;}); When I run the application, I get an error that "does not get a template with id readmpll while debugging in Chrome".
How do I apply the Hot Towel in my html template?
Thanks for any help.
We encountered this week with the inline template, the only issue on the job. It seems that Durandal does not play well with inline templates.
Our solution is to use the external template, stored in the file next to the main file, and then call them with the following line:
< Code> & lt ;! - ko compose: {view: 'path /' + templatetuos + '. Html ', Model: yourModel} - & gt; can not be elegant, but at least it is working.
Let me know if your problem is resolved :)
Comments
Post a Comment