itteco / meteor-oembed

Add oEmbed support to your Meteor.js app
https://iframely.com
MIT License
13 stars 8 forks source link

Adding fields to template #1

Closed malcolmevans closed 9 years ago

malcolmevans commented 9 years ago

Hi there,

I'm trying to create a meteor form with 3 fields. Title, description and URL. Once the form is submitted the title and description would appear above the embedded URL. I have your base code working to type in a video url and have it appear embedded, but am struggling to add the title & description fields to the template.

Can you help me? I'm a coding newbie so please forgive if its a basic question.

Thanks!

nleush commented 9 years ago

If your data record has format:

{
  title: 'Some video',
  description: 'Video description',
  url: 'http://www.youtube.com/?v=sf73k'
}

Then like in example project (https://github.com/nleush/meteor-iframely-demo/blob/master/client/urls.html) your template will look like:

{{#each items}}
  <p>{{title}}</p>
  <p>{{description}}</p>
  <p>
    {{>oembed}}
  </p>
{{/each}}
malcolmevans commented 9 years ago

Thank you for your response Nazar!

I think my difficulty is in getting the embed event to add multiple data fields to the data record. Any time i introduce new variables, the core embed function stops working.

I've created a demo repo here: https://github.com/malcolmevans/iframely-addingfields - and the last commit shows the changes I've been trying to make. Any chance you can give a quick peek to see what I might be doing wrong?

Thank you so much!!

nleush commented 9 years ago

Add row:

Tasks = new Mongo.Collection("tasks");

to server/common.js

Its workaround of insecure package to work with collection on server side.

malcolmevans commented 9 years ago

Wow, so simple, thank you!!!