Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Use select2.css styles as starting point #8

Merged
merged 2 commits into from
Nov 18, 2013
Merged

Conversation

dimirc
Copy link
Contributor

@dimirc dimirc commented Nov 12, 2013

Instead of creating the styles from scratch, we could start with same css from select2 and later on modify them if needed.

Here is a demo with these changes

@dimirc dimirc mentioned this pull request Nov 15, 2013
@dimirc
Copy link
Contributor Author

dimirc commented Nov 17, 2013

With this new commit I added some child-directives

<ui-select ng-model="data.custom" style="width:300px">
  <match placeholder="Pick one...">{{$select.selected.name}}</match>
  <choices data="item in data.items | filter : $select.search">
      <div ng-bind-html="trustAsHtml((item.name | highlight:$select.search))"/></div>
      <div> {{item.email}} </div>
  </choices>
</ui-select>

Current features:

  • Now its possible to customize list-item <choices> and selected <match>
  • Text is highlighted on label
  • When moving with cursor up/down, scroll the matches to always keep them visible
  • Lose focus when clicking outside the control
  • Specify Placeholder at <match> directive

The demo is updated

@ProLoser
Copy link
Member

Instead of using dom traversal, create child directives. This way the child directive can provide you with the html you need. Unfortunately it will not be as clean to inject the html back in.

I would create a non-select2 class in addition and use that instead of hard coding the select2 classes into the Javascript

dimirc added a commit that referenced this pull request Nov 18, 2013
Use select2.css styles as starting point
@dimirc dimirc merged commit d0c290c into master Nov 18, 2013
@dimirc dimirc deleted the select2css-based branch November 18, 2013 04:44
@dimirc
Copy link
Contributor Author

dimirc commented Nov 18, 2013

@ProLoser I created a new pull request with some changes related to what we were talking here. Specially throwing templates on separate files

hiersekornc pushed a commit to hiersekornc/ui-select that referenced this pull request Jan 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants