add design pattern for angularjs