pug

Is it possible to render x.jade partial in angular?

点点圈 提交于 2019-11-29 23:05:18
The following code works if i was rendering some.html instead of some.jade . angular.module('myApp', []). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/', {templateUrl: 'partials/some.jade', controller: myAppController}). otherwise({redirectTo: '/login'}); }]); Is it possible to render a jade file as a partial in angular? Sangram Singh Yes it is possible. Look at the following link Two important points to note are: templateUrl: 'partials/some' instead of templateUrl: 'partials/some.jade' and Add the following in routes: ( the code is for expressjs in node) app.get

Using Jade templates in Backbone.js

这一生的挚爱 提交于 2019-11-29 23:02:18
I love the HAML-like syntax of Jade's templating engine in Node.js, and I would love to use it client-side within Backbone.js. I've seen Backbone commonly using Underscore.js templating in the following style. /* Tunes.js */ window.AlbumView = Backbone.View.extend({ initialize: function() { this.template = _.template($('#album-template').html()); }, // ... }); /* Index.html */ <script type="text/template" id="album-template"> <span class="album-title"><%= title %></span> <span class="artist-name"><%= artist %></span> <ol class="tracks"> <% _.each(tracks, function(track) { %> <li><%= track

Submit Jade form

这一生的挚爱 提交于 2019-11-29 22:39:02
What is the error with the following Jade form template? I can't get it to submit values. div form(action='/signup',method='post') div(data-role='fieldcontain') fieldset(data-role='controlgroup') label(for='email') email input(id='email',type='text',value='',placeholder='@') div#passworddiv(data-role='fieldcontain') fieldset(data-role='controlgroup label(for='password') password input(id='password',type='password',value='',placeholder='') div(id='hiddendiv',data-role='fieldcontain') fieldset(data-role='controlgroup') label(for='hidden_password') password input(id='hidden_password',type='text'

Jade: Links inside a paragraph

一个人想着一个人 提交于 2019-11-29 20:21:22
I'm trying to author a few paragraphs with Jade, but finding it difficult when there are links inside a paragraph. The best I can come up with, and I'm wondering if there's a way to do it with less markup: p span. this is the start of the para. a(href="http://example.com") a link span. and this is the rest of the paragraph. As of jade 1.0 there's an easier way to deal with this, unfortunately I can't find it anywhere in the official documentation. You can add inline elements with the following syntax: #[a.someClass A Link!] So, an example without going into multiple lines in a p, would be

Jade: load external javascript and call function

試著忘記壹切 提交于 2019-11-29 18:41:11
问题 I was learning Express/Node/Jade and now in the Jade file I want to include a javascript file from the public folder just for the page. For example, in jade file I type this: script(src='/javascripts/test.js') and inside test.js I have a function function check_test(){ return "It's working!" } then I try to call the function in Jade by - var test_response = check_test() than I got the error saying that "undefined is not a function" and test.js isn't load at all. Apparently Jade doesn't load

Node JS Pass a Variable to Jade / Pug

不羁岁月 提交于 2019-11-29 17:35:02
问题 For some reason I can't pass a variable to the pug template with Node JS. app.get("/", function (req, res) { res.render('index', { hello : 'Hey'} ) }) .... extends layout.pug block content h1 #{hello} guy This just returns "guy" in the index.html file 回答1: I think you are using JADE coding (#{hello}) with "pug"(updated jade) plugin with static .html -- completely wrong. follow the lines below: use this first app.set('views', __dirname + '/public/views'); app.set('view engine', 'pug'); than

Using !{ } and #{ } interpolation in a jade template (exclamation-object, hash-object)

为君一笑 提交于 2019-11-29 17:14:35
问题 In a jade template (using express over node.js), I see a template using the following syntax: script(type='text/template', id='data-services') !{data} I don't understand the !{ } construct; apparently it interpolates a javascript object defined elsewhere as: var data={ name:"Doe", age:"21" }; Jade docs & tuts show the use of #{ } for interpolation, but I don't see !{ } . Even #{ } is not documented, so I think it's not jade-specific. Where does this syntax come from and where is it documented

Expressjs not loading stylesheets on heroku, giving 500 error

落爺英雄遲暮 提交于 2019-11-29 15:50:50
问题 I'm running an Expressjs installation on heroku, and it's not loading the stylesheets. I hit ctrl+u and then click on the stylesheet link, and get this error: TypeError: Object #<SendStream> has no method 'on' at Object.static [as handle] (/app/node_modules/express/node_modules/connect/lib/middleware/static.js:75:8) at next (/app/node_modules/express/node_modules/connect/lib/proto.js:190:15) When I go to the url '/stylesheets/style.css' I get this error: Express 500 TypeError: Object #

change jade always require node.js restart then can verify the change

我们两清 提交于 2019-11-29 15:46:50
I'm using Jade as template engine at node.js. I have to stop node.js and start whenever I made changes to Jade file so I can verified the change. Is there tool or a way that if I made change to Jade I don't need to restart node.js app? Changes to Jade templates should be picked up automatically after you reload the page, at least in development mode. If not, then the most likely cause is that view caching is enabled in Express, which is the default if the NODE_ENV environment variable is set to production , or caching is explicitly enabled. To explicitly disable view caching, you can use this:

Can angular be used within a jade template?

梦想的初衷 提交于 2019-11-29 14:52:54
I am new to both angular and jade. I was wondering if angular can only be used with HTML, or if I could use the same angular call within a jade template? I have only seen angular templates being used with HTML, and have not found it used in any jade templates. is it possible to do such a thing? How would angular in a jade template look? Yes you can. It would look something like: body(ng-app) button(ng-click="yourAngularFunc()") You can download the angular-express-bootstrap-seed - A great starting point for writing AngularJS apps sauced with Twitter Bootstrap and backed by an Express-powered