Update directives.js

fix problem  with array