Angular ng-init same like in Vuejs
In Vuejs we do not have ng-init as default but we can create it in vuejs by using directive.
Vue.directive('init', { bind: function(el, binding, vnode) { vnode.context[binding.arg] = binding.value; } });
and we can use it like:
<div v-init:myvar="'foo'"></div>
Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.
Yes0
No1