I'm struggling to implement buttons that switch ons-templates when clicked. I've been following this example as a reference:
Here's the code snippet I've been working on, but it just won't cooperate:
<!doctype html>
<html lang="en" ng-app="store">
<head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
...
</body>
</html>
This is how my app.js file looks like:
(function() {
ons.bootstrap();
var app = angular.module('store', []);
app.controller('StoreController', function(){
var productIndex = 0;
this.currentProduct = items[productIndex];
this.nextProduct = function() {
productIndex = productIndex+1;
this.currentProduct = items[productIndex];
};
this.prevProduct = function() {
productIndex = productIndex-1;
this.currentProduct = items[productIndex];
};
});
...
If anyone could offer some guidance or assistance, it would be highly appreciated!