aurelia / aurelia/framework

Using element selector in view model used in composition doesn't work

Open
#771 3 comments 0 reactions 0 assignees View on GitHub
bug question
Dominant language
TypeScript
Stars
11.7k
Forks
608
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a bug report**

* **Library Version:**
1.1.2

**Please tell us about your environment:**
* **Operating System:**
Windows 10 Pro

* **Node Version:**
6.10.0

* **NPM Version:**
3.10.10

* **Aurelia CLI OR JSPM OR Webpack AND Version**
webpack 2.2.1

* **Browser:**
all

* **Language:**
TypeScript 2.3

**Current behavior:**
Using selector in a viewmodel to get an element marked with ref="" doesn't work when the view/viewmodel is used in a composition.

View: `

    `
    ViewModel: `attached() { console.log(this.hisory); }` returns undefined.

    **Expected/desired behavior:**
    Referenced element should be available in the viewmodel.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the composition case described in the view and view model, using the `ref="history"` element and checking the value during `attached()`. Trace how composition supplies the view model and how the referenced element is exposed; done means the referenced element is available in the view model in that scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.