Sunday 18 February 2018

How do I access properties on a class in a view?

I do not know if this approach is wrong, if so please do tell, as I am new to NodeJs. But I am trying to achieve in Handlebars, to access a method. The way I have it structured is like this: I have a Series component which has the following: * Series.js * SeriesController.js * SeriesDAL.js * SeriesService.jsIn the Series.js I have a function to get all series with simple select all, SQL. I then create a new instance of SeriesDAL, and wrap all the results around a SeriesDal class. Inside the SeriesDal, I wrap each result into a SeriesService.Then I have a class of SeriesDal with an array of SeriesServices.Now I have two problemsThe first is my result set looks like this:SeriesDal { series: [ SeriesService { serie: [Object] }, SeriesService { serie: [Object] } ] } Which means in my view I have to do a loop inside of a loop to reach the series.Can I somehow reach something that looks like this:SeriesDal { [ SeriesService { [Object] }, SeriesService { [Object] } ] } So that I only have to loop through it once?The second thing is, now in my view, in my loop I am on the SeriesService entry, and let's say I have a custom getLinkRef How would I access this getLinkRef method/propertyExample of the code I have currently made: http://ift.tt/2EAWzsF in advance hope someone can give me a hand here.

Submitted February 18, 2018 at 03:09PM by cawex

No comments:

Post a Comment