-
-
Save jdanyow/173e62d9adfc6b776814 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./repeater"></require> | |
<h3>Remove the first repeater (0), alert should show 'Detached content 0' but shows 'Detached content 1'.</h3> | |
<div> | |
To fix the issue, open repeater.js, and uncomment 'detached() {}'. | |
</div> | |
<br> | |
<div repeat.for="repeaterId of repeaterIds"> | |
<repeater repeater-id.bind="repeaterId"></repeater> | |
<button click.trigger="$parent.removeRepeaterId(repeaterId)">Remove me</button> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App { | |
repeaterIds = [0, 1]; | |
removeRepeaterId(repeaterId) { | |
let index = this.repeaterIds.indexOf(repeaterId); | |
this.repeaterIds.splice(index, 1); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
Content ${repeaterId} | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {bindable} from 'aurelia-framework'; | |
export class RepeaterContent { | |
@bindable repeaterId; | |
detached() { | |
alert(`Detached content ${this.repeaterId}`); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./repeater-content"></require> | |
Repeater ${repeaterId} | |
<repeater-content repeater-id.bind="repeaterId"></repeater-content> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {bindable} from 'aurelia-framework'; | |
export class Repeater { | |
@bindable repeaterId; | |
// To fix the issue, uncomment detached() function | |
//detached() {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment