pug

Using Infinite scroll in angularjs and jade

左心房为你撑大大i 提交于 2019-11-30 21:50:02
问题 I'm using angularjs infinite scroll in my dashboard web app. I have a single page which holds multiple infinite scrollable widgets. Since I want to have an infinite scroll for each of them I decided to use this directive but somehow it's not working as expected. I want the infinite scroll to work relative to the inner content div scrollbar which uses perfect scrollbar instead of main browser window. I have searched on google and found multiple threads explaining 2 new variables which can be

Jade Templates - Dynamically Calling a Mixin

試著忘記壹切 提交于 2019-11-30 21:36:27
How can I use a string from the json being fed into a Jade template to dynamically load a mixin? Below, the goal is for twoColumn.jade to load the foo and bar mixins. twoColumn.jade mixin twoColumns(obj) .container-fluid .row(class=obj.class) for item in obj.items .col-xs-12.col-sm-3 //- Syntax for dynamically calling a mixin? +item.template(item) content.json { "twoColumns": { "class": "foobar", "items": [ { "template": "foo", "title": "Hello" }, { "template": "bar", "title": "World" } ] } } This is a feature that is not very obvious in Jade, as it is not explicitly mentioned in the

How does one add a conditional inside of a link in jade?

只愿长相守 提交于 2019-11-30 20:04:24
How does one add a conditional inside of a tag (link/anchor in my case) in jade? Here's my pseudo code that of course won't work: a(href="/foo", class="if (current_route[1] == 'foo'){active}") Go to Foo How about a(href="/foo", class=(current_route[1] === 'foo')? "active" : "") Go to Foo 来源: https://stackoverflow.com/questions/9488029/how-does-one-add-a-conditional-inside-of-a-link-in-jade

AngularJS/Jade Error: Argument 'MyController' is not a function, got undefined (MEAN)

拥有回忆 提交于 2019-11-30 19:44:18
I know variations of this question have already been asked several times, but I've tried several suggested solutions for other OPs, haven't been able to resolve this, and would appreciate some clarification. I'm working with the basic mean todo list app ( http://www.mean.io/ ). After implementing a simple controller I'm running into the "Error: Argument 'nameOfMyController' is not a function, got undefined." Here's where I'm at: app.js (boilerplate) window.app = angular.module('mean', ['ngCookies', 'ngResource', 'ui.bootstrap', 'ui.route', 'mean.system', 'mean.articles' ]); angular.module(

How to compile jade templates in to JavaScript functions to use them on client side?

醉酒当歌 提交于 2019-11-30 18:08:37
I want to use compiled jade templates on client side. How should I compile them to get javascript files ? https://github.com/visionmedia/jade Look for proposed solutions in the jade issue 149 discussion . Unfortunately, there is no built-in ready for use option, as I know. Yes you can! https://github.com/techpines/asset-rack#jadeasset I just open sourced "asset-rack", a nodejs project that can can precompile jade templates and serve them in the browser as javascript functions. This means that rendering is blazingly fast, even faster then micro-templates because there is no compilation step in

How to pass value to a onclick function in (Jade)pug?

一笑奈何 提交于 2019-11-30 17:53:06
问题 I am new to jade and stuck on this issue. I think I have tried everything from the StackOverflow posts and still at nothing. The things I have tried button(type='button' class=' c-btn-blue c-btn-circle c-btn-uppercase' value="Read More" onclick='gotoBlog( #{val.link} )') Error 1:8 Uncaught SyntaxError: Invalid or unexpected token Changing it to !{val.link} Error Uncaught SyntaxError: Unexpected token . Changing it to "!{val.link}" and "#{val.link}" just gives me string understandably so. BTW

Jade Templates - Dynamically Calling a Mixin

心不动则不痛 提交于 2019-11-30 17:14:44
问题 How can I use a string from the json being fed into a Jade template to dynamically load a mixin? Below, the goal is for twoColumn.jade to load the foo and bar mixins. twoColumn.jade mixin twoColumns(obj) .container-fluid .row(class=obj.class) for item in obj.items .col-xs-12.col-sm-3 //- Syntax for dynamically calling a mixin? +item.template(item) content.json { "twoColumns": { "class": "foobar", "items": [ { "template": "foo", "title": "Hello" }, { "template": "bar", "title": "World" } ] } }

How to include a css file in jade (without linking it)

拈花ヽ惹草 提交于 2019-11-30 14:56:56
问题 I have this jade file: !!! 5 html head title test include style(type='text/css') //- DOES NOT WORK! include test.css body //- works include test.css div //- works include test.css The output: $ jade -P test.jade rendered test.html $ cat test.html <!DOCTYPE html> <html> <head> <title>test include</title> <style type="text/css"> //- DOES NOT WORK! include test.css </style> </head> <body>body { color: peachpuff; } <div> body { color: peachpuff; } </div> </body> </html> Of course, I could simply

Jade: load external javascript and call function

落爺英雄遲暮 提交于 2019-11-30 13:46:00
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 the file, they only transform into HTML code. I look someone else's question and this is the closest one

Jade - missing space before text for line x of jade file

…衆ロ難τιáo~ 提交于 2019-11-30 13:38:10
问题 I'm making an Express based web application and everytime someone visits this jade file i get the following error: Warning: missing space before text for line 28 of jade file "C:\x\app\view s\login.jade" It also spits it out a few times for each line it happens on. I took a look at these lines and I can not figure out what it's complaining about. My jade file is as follows: doctype html html head meta(charset='utf-8') link(href='style.css', rel='stylesheet') body .wrapper header.header a(href