I have an array of jobs in my js/controller. Each job object in the array has attributes like jobName, company, city, etc. Is it possible by submitting a form with inputs for the attributes to make it into a job object and then push it into the jobs array in the controller?
So for example, I have a form and I input Software Developer, StackOverflow, NY. Can I wrap the form into an object with the correct attributes and then pass it into the array of jobs in the controller to view it on the view?
Here's my form code so far...
<form name="jobForm" ng-submit="list.addJob(jobForm)">
<div class="form-group" id="test">
<label>Job Name:</label>
<input ng-model="jobName" type="text"/>
</div>
<div>
<label>Company:</label>
<input ng-model="companyDescription" type="text"/>
<div><button type="submit">Enter job entry</div>
</div>
<!-- this is where the live preview is. ng-model in the input binds it to these values -->
<blockquote>
<h4><u>Live Preview</u></h4>
<b>Job Name:</b> {{jobName}}
<div><b>Company:</b>{{companyDescription}}</div>
</blockquote>
</form>
So I want to create a JOB object using the jobName and companyDescription's inputs as the object's name and company attribute. How can I do this? OR am i using a wrong approach. Thank you for the help!