allenhwkim / angular-template Goto Github PK
View Code? Open in Web Editor NEWNodeJS AngularJS Server-Side Template Engine
NodeJS AngularJS Server-Side Template Engine
I am generating documentation with angular-jsdoc
with gulp. I am successfully able to generate docs with default template but following issue comes with angular-template
processing template: E:\lokinder\tmd\desktop\node_modules\angular-jsdoc\angular-
template\html\layout.html
error in line undefined
E:\lokinder\tmd\desktop\node_modules\angular-template\index.js:140
throw e;
^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet sup
ported outside strict mode
at Function (native)
at templateFunc (E:\lokinder\tmd\desktop\node_modules\js-template\index.js:5
6:12)
at jsTemplate (E:\lokinder\tmd\desktop\node_modules\js-template\index.js:65:
18)
at angularTemplate (E:\lokinder\tmd\desktop\node_modules\angular-template\in
dex.js:128:14)
ng-if is not working
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\ringle\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "angular-template" "--save"
npm ERR! node v6.1.0
npm ERR! npm v3.10.7
npm ERR! code E404
npm ERR! 404 no such package available : @types/node
npm ERR! 404
npm ERR! 404 '@types/node' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'parse5'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! Please include the following file with any support request:
npm ERR! C:\workspace\reporting-service\npm-debug.log
{{1234,5 : number:2}} // 1,234.50
So, as the title says, i'm trying to pass an object to my data object on my htmlTemplate function. I'm doing something like this htmlTemplate('./templates/template.html', scope, { prefix: 'ng' });
where "scope" is an object which contains another object, "client" which has the client's data (e.g. name, address, etc...), so then when i try to use those values in my "template.html" as <p class="card-text">{{client.name}}</p>
it does nothing. I know this is not necessarily a bug neither and issue, but it is a feature that would really help a lot.
Thank you for your time!!
Hi,
currently it is not possible to pass options to cheerio.load.
E.g. if you need { xmlMode: true }
See options
https://github.com/fb55/htmlparser2/wiki/Parser-options
Would it be possible to have something like
options : {
cheerioOptions: {
xmlMode: true
}
}
var $ = cheerio.load(html,options.cheerioOptions);
Right now it's HtmlTemplate(template, scope, options), but Angular does $compile(template)($scope)
$compile should maybe be provided with a factory function, that takes options so it can be configured still.
$compile = $compileProvider(options); // returns $compile function
$compile(template)($scope); // does what HtmlTemplate does
Am I missing a reference?
`c:\Users\DDavidson\node_modules\angular-template\index.js:95
throw e;
^
ReferenceError: toInt is not defined
at jsonStringToDate (c:\Users\DDavidson\node_modules\angular-template\pipes\date.js:128:16)
at Function.module.exports (c:\Users\DDavidson\node_modules\angular-template\pipes\date.js:72:53)
at eval (eval at templateFunc (c:\Users\DDavidson\node_modules\js-template\index.js:55:12), :3:255)
at jsTemplate (c:\Users\DDavidson\node_modules\js-template\index.js:66:18)
at angularTemplate (c:\Users\DDavidson\node_modules\angular-template\index.js:83:14)
`
hi:
when the variable is missed,the template will throw error.
html:
Also figure out how to avoid <html>....</html>
for partial templates.
I had an image "getting-started.gif" and my prefix is "ng". The regexp replace changed my image path to "gettiht-started.gif" which broke the image. I suggest adding a word boundary to the regexp in index.js:
if (options.prefix) {
html = html.replace(new RegExp("\\b"+options.prefix+"-",'g'), "ht-");
}
Should work the same way as in angular js
{{ limitTo_expression | limitTo : limit : begin}}
This is really handy,
Would love to have an angular2 template engine for server side
I did some hacks to make it work for my scenario, but with limited support for angular2 .
https://github.com/tomalex0/compile-ng2-template/blob/master/index.js #
https://stackoverflow.com/questions/46351356/email-newsletter-implementation-using-angular2
This triggered me to look for similar implementation as yours
Thanks for this library. But could you provide the above directives support
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.