Ember.js 4.4 classic template syntax

182 Views Asked by At

I would like to update a project built in Ember 3.28 without Octane to version 4.4.

I tried using ember-cli-update to change version and now all sorts of errors are thrown, such as template properties that must be used with @ and curly brackets components no longer supported...

I am new to Ember and I haven't understood if it is still possible to use the classic syntax on 4.4, if so, how can I continue to use the classic syntax? Especially on templates.

Thank you!

1

There are 1 best solutions below

0
On

I am new to Ember

Hello! and welcome!!


is still possible to use the classic syntax on 4.4,

it is not possible to use some classic syntax after Ember 4.0.

In particular, when you have {{theseThings}} you must:

  • have theseThings defined in scope (like in strict mode, or via let, or component yield)
    {{#let ... as |theseThings|}}
       {{theseThings}}
    {{/let}}
    
    or
    <Foo as |theseThings|>
      {{theseThigs}}
    </Foo>
    
  • change the invocation to be declared as an:
    • argument (prepend a @, so {{@theseThings}})
    • local variable on "the context" (this / the class instance), so: {{this.theseThings}}

There is a codemod to help out with these things, but it's a bit finnicky, and you'll want to go file-by-file: