Use ng-repeat to reduce duplicate code