reset password
Author Message
fumjum
Posts: 27
Posted 01:35 Nov 29, 2016 |

I was able to successfully get the data for this assignment into my html file by modifying the code from the contact list app we did in class. However, I can't figure out how to query the specific types (ie: edu, skill, project). I have the data in tables and only the data I need comes in, but only because each item has different keys. The table is filled with blanks for the data where there is no such key. For example the Skills table has 3 blank rows where the education data would be and then the three skills from the database then two blank rows where project data would be. The other data is blank because it doesn't have a key called skills. In which file do I query the data by type? In the html file? In the controller? What is the code process for doing so as the database was not queried in the contact list app to my knowledge. Thanks for any help.

JackStrauss
Posts: 236
Posted 01:49 Nov 29, 2016 |

You should use 4 models: admins, edu, skills, projects.

Also, try to use MVC architecture.

It's going to be a lot of code, so this is why you want 4 models.

 

HWK3 wasn't easy.

 

In your models, you create the edu object, skills objects, projects object, and admin object.

 

So the actions that you did to query for one, is similar to the actions that you will do to query for another one.

 

You only need one controller, however.

 

I posted a demo app, and youtube video tutorial.

 

Find it here: http://csns.calstatela.edu/department/cs/forum/topic/view?id=5691760

 

It might answer your questions.

Feel free to demo my app.

Last edited by JackStrauss at 02:08 Nov 29, 2016.
msargent
Posts: 519
Posted 02:51 Nov 29, 2016 |

Use different variables in your $scope for the different queries, and in your directives. For instance, if you put into your $scope 'entry' in your controller and use it in all three of your loops, you will get extra rows. 

In your edu table, use something like <tr ng-repeat="school in schools">, and put "schools" in your scope in the controller. Then use <tr ng-repeat="skill in skills">, for your skills, and so on. Avoid namespace pollution that you get when you use the same variables over and over. 

 

Last edited by msargent at 02:53 Nov 29, 2016.
BrianK
Posts: 25
Posted 08:26 Nov 30, 2016 |

Nevermind

 

Last edited by BrianK at 08:36 Nov 30, 2016.