javascript - AngularJS Abstraction -


i noticed while using angular, html became full of inline-js looking code.

for example:

<table>     <tr>         <td ng-click="move('nw')" id="nw" ng-bind-template="{{northwest}}"></td>         <td ng-click="move('n')" id="n" ng-bind-template="{{north}}"></td>         <td ng-click="move('ne')" id="ne" ng-bind-template="{{northeast}}"></td>     </tr>     <tr>         <td ng-click="move('w')" id="w" ng-bind-template="{{west}}"></td>         <td ng-click="move('center')" id="center" ng-bind-template="{{center}}"></td>         <td ng-click="move('e')" id="e" ng-bind-template="{{east}}"></td>     </tr>     <tr>         <td ng-click="move('sw')" id="sw" ng-bind-template="{{southwest}}"></td>         <td ng-click="move('s')" id="s" ng-bind-template="{{south}}"></td>         <td ng-click="move('se')" id="se" ng-bind-template="{{southeast}}"></td>     </tr> </table> 

it's more or less been beaten head javascript should abstracted html. know angular bit of special case, , uses lot of attribute methods, possible separate html , angular dom method?

like:

var north = document.getelementbyid("n"); north["ng-click"] = function() { move(this.id); } 

you that, you're destroying point of declarative binding syntax.

at end of day, every "garbage" find in html markup easy strip out. try same in code.

in order implement true abstraction, need develop neutral wrapper on angular, knockout , every binding (and other things) libraries. html binding provider model.

it interesting, why not, going waste time because don't prefer unobstructive model binding? ;)


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -