Function assertion from angular.js