1

I'm trying to add {{}} for angular {{}} to Jade. In html you do this

 <p>{{ whatever  }}</p>

In jade, my understanding was:

p  {{ whatever }}

But it is not working. Any insight on how to add the double curly brackets to Jade so it display the information from Angular (react or vue, they all work the same way)

I tried

p {{ }}

p
  |{{ }}

p
= {{ }}

Any Jade ninja out there?

2
  • Weird, I've been using p {{vueData}}, it works fine. Maybe post your compilation error here? Commented Nov 30, 2016 at 3:24
  • I will try again and get back to you later on today. Thanks. Commented Nov 30, 2016 at 14:06

4 Answers 4

0

In "jade": "1.9.2", if you have following in JS:

res.render('blog_edit', {title: 'edit your blog', posts: "something"});

In template, you can use either of follwing:

#{locals.posts}

or

#{posts}
Sign up to request clarification or add additional context in comments.

11 Comments

Hi, I'm not trying to use interpolation which to pass from express to jade.
I'm trying to use what Angular, React and VueJS use which the double {{ }}
@Marco Angular does interpolation of variable using {{}}.
Yes I'm talking about the double curly bracket not the single one. Your answer is showing the single bracket, right? Or did you mean to type double curly brackets?
What did I miss? It seems I missed your your and I'm trying to add double {{}} not the single {}....
|
0

First thing to check,

  1. did you specified ng-controller? if not, you should.

    body(ng-app="myApp" ng-controller="MainCtrl as main")

  2. does your controller has that value? if not, you can create test code.

    $scope.test = "test"
    p {{ test }}

  3. did you include angular.js?

    script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js")

  4. did you correctly create angular app?

    var app = angular.module('myApp'); app.controller('MainCtrl', function($scope){ $scope.test = "test"; }

  5. did you include your angluar app?

    script(src="javascripts/myApp.js")

  6. {{ }} should not have space between { and {.

If you still have a problem let me know.

5 Comments

HTML runs the app ok. So it is not a reference issue. It is when I try to display the data entered by a form on the page. I will post code later on today. It is the {{vue data entered in a form}} that doesn't display the data. The form and everything else is working fine in the html
Did you connect data form with ng-model?
It was my mistake. I referenced the app.js before block contents but it should be after it.
body block content script(src="./javascripts/vueapp.js")
Thank you for your help. When you said you use {{}} all the time, made me question my js files reference.
0

Reference your vue files in jade (in express app, layout.jade) after block contents not inside the body tag:

body
//not here
block content
script(src="./javascripts/vueapp.js")

Comments

0

There is an alternative. Just put ng-bind, like this:

div(ng-app="" ng-init="name=' Rodrigo'")
        p My name is
            span(ng-bind="name")

Jade is no longer Jade hahaha, now it's Pug.js I know we are in 2018, but this is my small contribution

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.