Passing Scope into a Named Template
Sending the right context object to a partial.
Partials Need Context
A named template can only read what you hand it. The second argument to include is the scope, the dot the partial will see inside.
{{ include "mychart.labels" . }}The Dot Is the Scope
That trailing dot is the current context. Passing the root dot gives the partial access to .Values, .Release, and .Chart.
All lessons in this course
- Defining a Partial with define
- Inserting Partials with template and include
- The Standard Fullname and Labels Helpers
- Passing Scope into a Named Template