Search Posts

Category: pug

What is the jade syntax to access variables in inline javascript?

All of my syntactic attempts have failed and the documentation on this particular case is hard to find, perhaps you know better. .factsheet(ng-repeat=”factsheet in factsheets) a(ng-href=”{{}}”, onclick=”aFunction(‘click’, {{factsheet.title}})”) ng-href=”{{}}”, works like a charm. {{factsheet.title}} is the variable which can’t be accessed. I’ve tried this factsheet.title and that #{factsheet.title} and this “{{factsheet.title}}” and other desperate attempts… ‘{{factsheet.title}}’, “#{{factsheet.title}}” Nothing works, although I can access the title attribute easily outside of the inline JS h2 {{factsheet.title[currentLang]}} // […]

Put text in the same line with Jade and AngularJS

I have this code in Jade: div(ng-repeat=”term in terms”) div.descriptionTerm.input-group(ng-repeat=”entry in term.entries”) strong.entry {{term.term}} sup {{entry.entry}} span.translations(ng-repeat=”trans in entry.translations”) span {{trans.term}}, This results in this view: Jade view I would like to have everything in the same line, but this is my first time using Jade and I have no idea. Source: AngularJS

How to do Angular1.3 work with Pug templates

I’d have some those “pug templates” and the stuff is breaking my work here. I only need to show divs when a message is put on the $scope or hide if its not, but the issue is, it always prints in the screen the string … like this code div(class=”alert alert-success” role=”alert” ng-show=’msgvalid != null’) span() {{msgvalid}} div(class=”alert alert-danger” role=”alert” ng-show=’error != null’) span() {{error}} Whil see below and will not process the variables {{msgvalid}} […]

How does socketstream/node/angularjs/jade get objects into the templates?

I’ve got some code that looks something like this: ss.client.define ‘main’, { view: ‘index.html’, css: [‘libs/foo.css’, ‘libs/bar.css’], code: [‘libs’, ‘foo’, ‘bar’], tmpl: [‘foo’, ‘bar’, ‘bang’], } ss.client.formatters.add require(‘ss-less’) ss.client.formatters.add require(‘ss-coffee’) ss.client.formatters.add require(‘ss-jade’) ss.client.templateEngine.use ‘angular’ Now, from what I gather from this page, socketstream just kind of magics some things around. But I’m kind of confused, I haven’t found a good explanation for just how the models get available for angular/jade. I have this code in […]

AngularJS ui-select not showing selected values

I get data in {{modalcontactData}} if i simply put this in my jade file its showing object like this: { “id”: 20, “gsm”: “123456789”, “firstName”: “Mohamed”, “lastName”: “Sameer”, “email”: “[email protected]”, “contactgroups”: [ { “id”: 1, “contactId”: 20, “groupId”: 14, “group”: { “id”: 14, “groupname”: “Angular”, } } { “id”: 3, “contactId”: 21, “groupId”: 15, “group”: { “id”: 15, “groupname”: “React”, } } ] } My jade code: .modal-body ui-select(multiple=”, ng-model=’modalcontactData’, theme=’select2′) ui-select-match(placeholder=’Select Groups…’) {{$item.groupname}} ui-select-choices(repeat=’ […]

ngRoute loads only template on refresh

I have a project using nodejs with express & pug in the backend, and AngularJS with ngroute on the frontend. The way it used to work was: I enter website, it loads index.html (with angular stuff) and then /home(with content created with pug) as a view. When i choose to enter another document, angular requests it from express, and server fills it with pug (eg. /users), angular loads it into view leaving menu,etc. untouched It […]

how to make one ng-repeat to work on different columns in different rows

I am trying to display data formulated like this using angular “a”:[{ “name”: “a’s name” “b”:[{ “name”:”b’s name” “c”:[{ “name”: “c’s name” “d”:[{ “name”:”d’s name” }] }] }] }] and i tried this but it couldn’t work tr td(ng-repeat=”oneB in a.b”) | {{}} tr td(ng-repeat=”oneC in oneB.c”) | {{}} tr td(ng-repeat=”oneD in oneC.d”) | {{}} and also this tr td(ng-repeat-start=”oneB in a.b”) | {{}} tr td(ng-repeat-end,ng-repeat-start=”oneC in oneB.c”) | {{}} tr td(ng-repeat-end,ng-repeat=”oneD in oneC.d”) | […]

unable to load dynamic page in view only mode based on condition

In jade file, on particular condition i need to make the field in view only mode. but when i give the condition ng-class=”details.lockedStatus.isLocked ? ‘view’ : ‘editView’” . The page is not fully rendered…… form(name=”mainForm” class=”form-horizontal” ng-class=”details.lockedStatus.isLocked ? ‘view’ : ‘editView'”) md-content(style=””) md-tabs(md-dynamic-height=”, md-border-bottom=”) md-tab(label=’Project Details’)”color:#315a8e”) Project Infomation md-content(md-theme=’docs-dark’, style=”font-size: 16px; width: 99%;” layout-padding=” class=”border”) div(ng-repeat=”p in details.project_details” class=”col-md-3″ style=”margin-top:10px; margin-top: 10px; float: left;”) md-input-container(style=”” ng-if=”p.type == ‘text'” class=”col-md-12″) label {{p.label}} <span style=”color:#ff0000″ […]

ng repeat json parse show empty string

I had the array of objects string from a list of array. I convert object string to object using method of JSON.parse the object but it shows empty within ng-repeat. Jade .item.col-md-4(ng-repeat=’p in searchData | filter: paginate | orderBy: sortKey ‘) // `p` is a object of string, for example “{id:2, name:’abel’}”; – var property = JSON.parse(“{{ p }}”); // Error at this line +AddPropertyCard(property) Error var property = JSON.parse(“”); Unexpected token { in JSON […]