Theme Pages consists of widgets. Widgets are reusable blocks that contain HTML template as
You can add a widget with the help of design theme.
Every widget provides a scope which contains variables and functions that widget's controller provides. Those variables and functions can be used in the widget template.
<div ms-widget="widgetName" ></div>
<div ms-widget="ms.product" >
Name: {{product.name}}
Price: {{product.price|msCurrency}}
<button ng-click="ms.cart.add(product)"> Buy Now</button>
</div>
<div ms-widget="ms.categoryProducts" >
Category Name: {{category.name}}
Numer of Products: {{category.productCount}}
Products:
<ul>
<li ng-repeat="product in products">{{product.name}}</li>
</ul>
</div>
<div ms-widget="ms.collectionProducts" >
Category Name: {{collection.name}}
Numer of Products: {{collection.productCount}}
Products:
<ul>
<li ng-repeat="product in products">{{product.name}}</li>
</ul>
</div>
<div ms-widget="ms.brandProducts" >
Category Name: {{brand.name}}
Numer of Products: {{brand.productCount}}
Products:
<ul>
<li ng-repeat="product in products">{{product.name}}</li>
</ul>
</div>
StoreHippo offers a number of global widgets that provide the basic functionality needed to create the store. For example, ms.product widget provides product object on the product page. Following are commonly used global widgets:
Global Widgets vs Global Objects
Global widgets provide variables and functions that are available for use within the scope of the global widget. However, there are certain variables or global objects that are available in the global scope. They are not related to any global widget and can be used anywhere in the theme. For example, ms.user is a global object.
There is a global widget ms.modal that opens the given widget in a modal window. The following code will open widget sampleWidget in a modal window.
<a href="javascript:void(0)" ms-widget="ms.modal" ms-data-widget="sampleWidget">Open SampleWidget in modal window</a>