Semantic-Org / Semantic-UI-Angular

Semantic UI Angular Integrations
MIT License
557 stars 117 forks source link

Added Flag Directive #31

Closed raduq closed 8 years ago

raduq commented 9 years ago

Added a simple directive for the flag element.

caitp commented 9 years ago

So, some discussion questions... How dynamic do we want this to be? The isolate scope makes it look like it should be dynamic, but is probably heavier than it needs to be. I don't think a new scope is really needed for this one.

Could do something like:

// dynamic:
function smFlag() {
  return {
    template: "<i class='flag ${flag}'></i>"
    scope: {
      'flag': '@' // '=' if 2-way binding is needed (eg as a form control for country selection),
    }
  };
}

With this version, the flag class is interpolated (slightly cheaper than the 2-way binding with the parent scope) --- and if the interpolated value changes, the DOM will be updated to reflect those changes.

There are lots of other ways you could do this too, EG using transclusion to let the user put arbitrary content next to the flag, etc.

If we're aiming for dynamic, we are definitely missing done tests which dynamically change the flag type

matheuspoleza commented 8 years ago

@raduq will you update this with my and @caitp opinions? Do u need something to complete this?