-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite the handling of promises for autocomplete and tokens
- Loading branch information
Showing
6 changed files
with
188 additions
and
51 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<div class="panel panel-info"> | ||
<div class="panel-heading"> | ||
Set tokens with a promise | ||
</div> | ||
|
||
<div class="panel-body"> | ||
<p>Promises can be used to set the current tokens.</p> | ||
{{input-tokenfield tokens=tokensPromise | ||
autocomplete=autocomplete | ||
placeholder="Type something and hit enter"}} | ||
<br> | ||
|
||
Controller | ||
<pre>// contribed example, this data is likely to come from ember-data | ||
tokensPromise: Ember.computed(function() { | ||
var tokens = [ | ||
{value: 1, label: 'one'}, | ||
{value: 2, label: 'two'}, | ||
{value: 3, label: 'three'} | ||
]; | ||
|
||
return new Ember.RSVP.Promise(function(resolve) { | ||
Ember.run.later(function() { | ||
resolve( tokens ); | ||
}, 3000); // simulate a 3 seconds delay | ||
}); | ||
})</pre> | ||
|
||
Template | ||
<pre>\{{input-tokenfield tokens=tokensPromise | ||
autocomplete=autocomplete | ||
placeholder="Type something and hit enter"}}</pre> | ||
</div> | ||
</div> |
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
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