Creating a separate directive for this is not needed. There is already a build in Angular UI password validation tool .
angular-ui/ui-validate · GitHub[
^] With this you could do:
<input name="password" required ng-model="password">
<input name="confirm_password"
ui-validate=" '$value==password' "
ui-validate-watch=" 'password' ">