Angular: Modeling and testing static furniture data

This app has a number of dropdowns and radio sets whose options are completely static, as in, could be hard coded in the HTML. Is it considered Angular best practice to do that, or to define data describing them in an appropriate controller, and render off that?

It's clearly less work for the browser to have them hard coded, but probably not significantly. Rendering off data is less code in the HTML, but more in the controller.

Would you unit test that those options are as expected? If you're looking at the unit tests as a specification to build to, not just verification of expected functionality, then you probably would. Far as I can see, you'd want to define them as model data to do that.

What's typical practice in this area?

If you can hard code it, go ahead. It's not going to break anything. You wouldn't have to test a hard-coded select, you could just trust that it was working. Likewise, if you just had an array that was only used to create the select, you wouldn't really have to test that either; because you could just trust that JavaScript works the way it's intended.

I guess you could just weigh the pros and cons:

  • Hard-coded
    • Pros
      • faster to render.
      • less overhead.
      • easy to understand
    • Cons
      • more typing.
      • data not as reusable.
  • From an Array
    • Pros
      • less typing.
      • slightly more reusable by other code.
      • easier to add new items (if you're lazy, haha)
    • Cons
      • more overhead
      • select takes longer to render out.

"Best practice" is whatever is easiest to maintain, testable, and works.