MeteorJS -how to combine Add & Edit template

72 views Asked by At

I'm trying to figure out how to create a standard CRUD app with one view for Create and Edit. Currently I have:

Flight_add.html
Flight_add.js
Flight_edit.html
Flight_edit.js

https://github.com/u843867/pilotlog5/tree/master/client/templates/flights

I'd like to combine into a Flight.html so that the create and edit use the same Template. Just not sure the best approach. By the way, I'm using iron:router Thanks.

1

There are 1 answers

2
Elie Steinbock On

Create the folder:

client/views/flight

Then stick flightAdd.html, flightAdd.js, flightEdit.html and flight.js to this folder.

Another option is:

client/views/flightAdd with flightAdd.html, flightAdd.js in the folder

client/views/flightEdit with flightEdit.html, flightEdit.js in the folder

But there's no right and wrong answer on how to structure your app. Take a look at this example for some guidance on how to structure your app: https://github.com/DiscoverMeteor/Microscope