refactor: grid initialization process

* use $parse service instead of directly accessing scope variables
* add more comments
* throw an error when grid options are not defined