Ionic equivalent for knockout?

I love the framework of Durandal and KO, I just consider them a more elegant and simple solution.

However, Angular with Google behind, he enjoyed the best marketing successes and, consequently, more choice settings.

Now is there something equivalent at the end of KO to Ionic? Or the war has already been won, and I just need to move on.

+6
source share
2 answers

I believe that you could just reuse Ionic CSS (like with Bootstrap, for example) to get a style for mobile devices, and then connect some binding know-how so that it responds to user actions.

A simple example: imagine you want to create a tabbed interface (I took the markup from docs )

<div class="tabs-striped tabs-top tabs-background-positive tabs-color-light"> <div class="tabs"> <a class="tab-item active" href="#"> <i class="icon ion-home"></i> Test </a> <a class="tab-item" href="#"> <i class="icon ion-star"></i> Favorites </a> <a class="tab-item" href="#"> <i class="icon ion-gear-a"></i> Settings </a> </div> </div> 

With ionic you should use ionic tabs , but with durandal / KO you have compose and views:

  <div class="tabs-striped tabs-top tabs-background-positive tabs-color-light" data-bind="delegatedHandler: 'click'"> <div class="tabs" data-bind="foreach: tabs"> <a class="tab-item" href="#" data-bind="delegatedClick: $parent.setView.bind($parent), css: {active: isActive}"> <i class="icon" data-bind="css: icon"></i> <span data-bind="text: title"></span> </a> </div> </div> <div data-bind="compose: {view: activeView, cacheViews: true}"></div> 

And then add doling to your vm:

 return { tabs: [ {title:'Test', view: 'test.html', icon: 'ion-home', isActive: ko.observable(false)}, {title:'Favourites', view: 'favs.html', icon: 'ion-star', isActive: ko.observable(false)}, ... ], ,activeView: ko.observable(), ,setView: function(view) { this.activeView(view.view || view); this.tabs.forEach(function(v){ v.isActive(v.view === viewName); }); } } 

This is just to give you an idea of ​​a possible approach. In the end, angular and KO are very similar ... And most of the ionic components of JS are already implemented in the durandal (for example, navigation closely resembles routing and composition).

+2
source

TL DR I don't know any alternative for KO / Durandal, but going your own way might be a better choice.

What I understand from Ionic is a wrapper around the core hybrid structure of Cordova. As you mentioned, it is built with the idea of ​​using AngularJS everywhere. In addition to being a wrapper, it also provides additional plugins.

So, essentially, if it is just a simplification for NG developers. I do not want to say that this is not a good job, but in fact you can do it all yourself with Knockout and Durandal. So far I have created several demo applications with Cordova + Durandal and I must say that everything is getting better and better, especially the node cli tools provided by Cordoba accelerate development. The big advantage in my opinion with this path is that you have complete freedom of which Frameworks and libraries you choose.

  • Choose any MVWh regardless of the JS structure you like
  • Choose your GUI (see Ratchet pretty slick :)
  • Choose the plugins you need or write yourself.
  • Determine which CSS you use as the best, or stick with the core if you don't care.
  • Enjoy modular and lazy loading with RequireJS :)
+9
source

Source: https://habr.com/ru/post/975109/


All Articles