AngularJS: restructuration of application

Change-Id: I83e8b8689eedf36e69c5d159e3e23dfd726344d7
Reviewed-on: http://review.couchbase.org/40748
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>