moved richDataTable object outside of scope and wrapped entire directive inside of anonymous function.