javascript - Should I use Ids for HTML elements in angularjs application -


'id' of input element , 'for' of label, associates label element , makes label clickable. in jquery/javascript easy find element using ids. in angularjs there no use of ids , angularjs need id of element anywhere , first question:

  1. should have ids make label clickable?

now, of suggest, depends on requirements, say, requirements says, need make label clickable. that's why, putting ids in input elements. problem comes, when trying create directives common html templates/sections (e.g. address) make reusable. , trying generate dynamic ids dynamic templates. becomes complex when dynamic templates nested. creates problem ng-required nested dynamic templates. other questions are:

  1. is worth have dynamic id generation , complexity, make label clickable (which kind of basic requirement ux)?
  2. is there way in angulrjs 'for' functionality of label without having ids?

with regards labels can include form element inside them:

<label>     label     <input type="text"></input> </label> 

when click on label in this jsfiddle input field focussed, work other input tag types.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -