use the link function to pass the groups to the scope