Refactored the code to separate the html and include it through ng-include.