AngularJS rewrite