title: illegal cyclic reference involving object models
body: <p>When I try to pass a list to the view page of a Play application I receive an error:</p>
  
  <pre><code>illegal cyclic reference involving object models
  </code></pre>
  
  <p>Error screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/z9lRw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z9lRw.png" alt="enter image description here"></a></p>
  
  <p>models.scala.html:</p>
  
  <pre><code>@(liValues: List[String])
  @for(value &lt;- liValues){
   &lt;li&gt;@value&lt;/li&gt;
  }
  </code></pre>
  
  <p>entry in routes files:</p>
  
  <pre><code>GET     /models/tictactoe                    controllers.ModelController.index
  </code></pre>
  
  <p>index method in ModelController.scala where I pass the values:</p>
  
  <pre><code>def index = Action {
    Ok(views.html.models(List("Link1" , "Link2" , "Link3")))
  }
  </code></pre>
  
  <p>Complete ModelController:</p>
  
  <pre><code>package controllers
  
  import javax.inject._
  import play.api.libs.json.Json
  import play.api.mvc._
  
  /**
   * This controller creates an `Action` to handle HTTP requests to the
   * application's home page.
   */
  @Singleton
  class ModelController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
  
    /**
     * Create an Action to render an HTML page with a welcome message.
     * The configuration in the `routes` file means that this method
     * will be called when the application receives a `GET` request with
     * a path of `/`.
     */
    def index = Action {
      Ok(views.html.models(List("Link1" , "Link2" , "Link3")))
    }
  
    def sj = Action {
  
        Ok(Json.toJson(List(1,2,3)).toString());
  
    }
  }
  </code></pre>
  
  <p>it seems I'm not declaring the list value in the view page correctly ?</p>