Directives

Learn about Vue.js directives and template syntax.

A directive is a special token that tells Vue what to do with a certain DOM element. In Vue.js, directives are in the form of HTML attributes that are prefixed to an HTML element. The purpose of a directive is to bind the HTML element to the Vue instance assets which lets Vue change that element in the DOM in case the assets on which that element depends upon are updated. These assets include data, methods, and other elements in the Vue instance. The general directive syntax is shown below:

Get hands-on with 1200+ tech skills courses.