Skip to content

Instantly share code, notes, and snippets.

@MakarovCode
Last active March 9, 2019 21:28
Show Gist options
  • Save MakarovCode/77cbf3151a0967e0c283df7e35eecbea to your computer and use it in GitHub Desktop.
Save MakarovCode/77cbf3151a0967e0c283df7e35eecbea to your computer and use it in GitHub Desktop.
angular.module('app.controllers', [])
.controller('mercadoCtrl', ['$http', '$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($http, $scope, $stateParams) {
$scope.productos = [];
$scope.Init = function(){
$scope.Cargar();
}
$scope.Cargar = function(){
$http.get("https://curso101.herokuapp.com/products.json").then(
function(res, status){
//Positivo
$scope.productos = res.data;
},
function(res, status){
//Error
}
);
}
}])
.controller('carritoDeComprasCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $stateParams) {
}])
.controller('menuCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $stateParams) {
}])
<ion-view title="Mercado" id="page1" ng-init="Init()">
<ion-content padding="true" class="has-header">
<div class="list card" id="mercado-card21" ng-repeat="producto in productos">
<ion-item class="item-avatar" id="mercado-list-item6">
<h2>{{producto.name}}</h2>
</ion-item>
<div style="margin: 0px; line-height: 250px; background-color: rgb(232, 235, 239); text-align: center;">
<img ng-src="{{product.sources}}" style="width: 100%;">
</div>
<div class="item item-body" id="mercado-list-item-container2">
<div id="mercado-markdown2" class="show-list-numbers-and-dots">
<p style="margin-top:0px;color:#000000;">{{producto.created_at}}</p>
</div>
</div>
<button id="mercado-button1" class="button button-balanced button-block">Agregar al carrito</button>
</div>
</ion-content>
</ion-view>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment