Recently learning Angularjs, but this article and angularjs not much relationship. After learning to use the route and Ng-view using the template, after discovering that the view is loaded, Firefox will report an error "discard the contents of the document Element", although the page is running normally, but always look awkward: (.
After careful review, found that the error points to the style sheet tag style of the end, this reflects: the original is a full HTML page, style sheet in the head tag is not a problem, but now these various view templates themselves use some of the styles are directly written to the template, So not in the head of the entire page, the HTML protocol is not supported! Although these styles are very simple, local features dedicated, but previously if you want to solve this problem, can only be built an entire style file of an app, the use of class to solve, you need a style for each function of the name, and then to each element reference, but this is not only troublesome, and Trouble! Because you can't write a generic style to an element! Very not reconciled, went to W3school, carefully studied the HTML5 document, found that HTML5 has supported the local style sheet ^_^. However, there are two requirements, the first need to be placed within a parent element, the second add property scoped. The modified template is as follows:
<DivID= "View-xxx"> <stylescoped= "scoped">A{}thead TR{}tbody TR{} </style> ...</Div><!--End of view -
Reload to see the perfect solution!
Fix error: "Content after discarding document element"--HTML5 new feature, local style sheet