bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Angular 2.0 support

Open wesleycho opened this issue 11 years ago • 37 comments

With Angular 2 on the horizon, we should start considering the path to migration.

Do we want to support a smoother transition with similar API to the current UI Bootstrap, or should we reimagine the api if they are too hairy or not ideal to support?

This issue is open to comment.

wesleycho avatar Mar 25 '15 05:03 wesleycho

From what I see so far of Angular 2, it seems that creating the tooltip and modal directives would be challenging. This might be because the Angular 2 API is still in early stages.

chrisirhc avatar Mar 25 '15 06:03 chrisirhc

https://github.com/angular/angular/commit/2041860a21c021efc10589533f23c8df6dc611d3 was added recently in support of dynamic loading of components, so it should be possible to do so programmatically.

wesleycho avatar Mar 25 '15 13:03 wesleycho

I think we should drop the current API, the API on this project is my least favorite aspect of the project over all. I think projects like angular-strap expose a more more expressive/flexible/versatile API. I don't say that to suggest that we should mimmick that project in any way shape or form, only that there is room for improvement.

BobbieBarker avatar Mar 25 '15 15:03 BobbieBarker

My team ended up strongly disliking angular-strap when we used it at my current company - some of the API was not well thought out at all such as for modals.

I am personally leaning towards a new set of API, since I suspect most companies will move towards a big bang upgrade or migrate from a different framework if they move to Angular 2, but I understand some will want a more gentler upgrade path. Even then, there are mini refactors people will have to do and fully convert their components to Angular 2 from Angular 1, and so adding refactoring to a better set of API would ease the migration pains IMO. I don't feel strongly about this stance though, and could be convinced this is the wrong path with a better argument.

To give some context to UI Bootstrap - it was originally conceived as a project that had some useful common enough components from what I understand if I remember what @pkozlowski-opensource has said in the past. It was not meant to mirror Twitter Bootstrap's js-based components in a 1:1 fashion.

wesleycho avatar Mar 25 '15 16:03 wesleycho

I think the core idea i was trying to communicate is we should be open to reinventing the API where it makes sense. We shouldn't box ourselves into supporting an API from 1.* if it doesn't make sense to do so. We should keep our options open.

BobbieBarker avatar Mar 26 '15 22:03 BobbieBarker

I would opt for free design (as Angular team did) and then figure out how to make the migration (manually done by users of the lib or with some temporary helpers)

laguiz avatar May 04 '15 21:05 laguiz

Sentiment I'm hearing from folks is that they would love API-compatible libraries that "just work" in Angular 2 to minimize porting effort.

We're doing this with $http, animations, ComponentRouter, and maybe more.

I know this a) isn't really possible for directives and b) constrains you on improving APIs as expressed in the sentiment in this thread. Still, something to consider in making it easy for folks to migrate...

As far as things that may be hard to achieve like overlays (tooltips, pop-ups, modals, etc.), we have some designs on this internally that we could share that may help on this and in other UI areas. Just let me know.

bradlygreen avatar Jun 18 '15 18:06 bradlygreen

@bradlygreen - interesting - we had exactly this dissuasion back at the Amadeus office :-) I will ping you / @naomiblack to see how we could find synergies on ng2 directives for BS. We would be willing to put some effort in this area.

pkozlowski-opensource avatar Jun 18 '15 18:06 pkozlowski-opensource

Linking this migration strategy document for reference - this will provide a potential technical solution for this issue if implemented.

wesleycho avatar Jul 01 '15 18:07 wesleycho

https://github.com/valor-software/ng2-bootstrap welcome on board if you wish :)

valorkin avatar Aug 23 '15 15:08 valorkin

We announced this today: http://angularjs.blogspot.com/2015/08/angular-1-and-angular-2-coexistence.html

Please let us know what you guys need to be successful in porting to Angular 2!

BTW, Jeremy Elbourn on our team will be giving a talk on "well behaved Angular 2 components" at AngularConnect with many helpful guidelines for success.

bradlygreen avatar Aug 26 '15 04:08 bradlygreen

Awesome post BTW If nothing will change, this weekend I will submit PR to ng2 with fixes to TS d.ts, because it drives me crazy some times (wall of warnings at ts build time)

@bradlygreen, other thing I really looking for and will appreciate is any note, peace of code, sample (at least something) is a way from html in string to render html binded to given context (like $parse, $interpolate, $compile in ng1). The top most explanation I have found is some tests in ng2:)

Thanks in advance

valorkin avatar Aug 26 '15 09:08 valorkin

Please do not pollute the issue with comments unrelated to the issue at hand @valorkin.

@bradlygreen I think we'll be fine when we are ready to make the move to migrate :) . At the very least, I'm sure @pkozlowski-opensource probably knows more about the details of the migration story from 1 to 2 than most of us.

wesleycho avatar Aug 26 '15 17:08 wesleycho

IMHO I think the current UI Bootstrap API does not fit at all the new component oriented paradigm, i.e. a modal should be defined (declaratively) in the view as:

<ui-modal [open]="showModal" animation="enabled" size="large">
  <signup-form (success)="..">...</signup-form>
</ui-modal>

Rather than created (imperatively) from the view controller:

    var modalInstance = $modal.open({
      animation: $scope.animationsEnabled,
      templateUrl: 'myModalContent.html',
      controller: 'ModalInstanceCtrl',
      size: size,
      resolve: {
        items: function () {
          return $scope.items;
        }
      }
    });

Looks a bit like React, but first one encourages isolation & reusability by providing a clear interface based on events & properties.

laurentgoudet avatar Sep 24 '15 13:09 laurentgoudet

@laurentgoudet we are still experimenting on what may work best with ng2. I will link the repository we are operating out of when the details are solidified (should be in the next week or two) so API discussion can happen in an issue there.

wesleycho avatar Sep 24 '15 14:09 wesleycho

It's a kind of magic.

Foxandxss avatar Oct 16 '15 22:10 Foxandxss

@wesleycho do you guys have new repo for ng2 ?

viktor-evdokimov avatar Jan 05 '16 03:01 viktor-evdokimov

Yes, we do. But it's not even remotely close to being ready. There were way too many changes in ng2 prior to beta for us to make any substantial progress on it. There are ongoing changes in beta as well that need to be accounted for so we don't have any time frame for release as we want to get it right. It's called ng-bootstrap and is located here.

Just a note again that it is under active development and thus no issues filed will probably be valid.

icfantv avatar Jan 05 '16 04:01 icfantv

Thanks, Adam

viktor-evdokimov avatar Jan 05 '16 07:01 viktor-evdokimov

I've no history in this, so little right to comment, but I'd suggest a new approach to allow the best possible interface, and then consider an intermediate/translation library to allow legacy apps to add the library and make only minimal changes.

ChaosCrafter avatar Feb 29 '16 02:02 ChaosCrafter