This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.constant('$ionicLoadingConfig', { | |
template: 'Loading...', | |
animation: 'fade-in' | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('starter.services', []) | |
.factory('Categories', ['$http', '$q', 'config', function($http, $q, config) { | |
//Endpoints Variables. | |
var categoriesEndpoint = 'categories', | |
categoryEndpoint = 'category/'; | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view view-title="Articles"> | |
<ion-content> | |
<ion-list> | |
<ion-item class="list card" ng-repeat="article in articles" type="item-text-wrap" href="#/tab/articles/{{article.nid}}"> | |
<h2 class="title">{{article.title}}</h2> | |
<div class="item item-image"> | |
<img ng-src="{{article.image}}"> | |
</div> | |
</ion-item> | |
</ion-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { | |
// Bar with tabs. | |
$stateProvider.state('tab', { | |
url: '/tab', | |
abstract: true, | |
templateUrl: 'templates/tabs.html' | |
}) | |
// Categories list tab. | |
.state('tab.categories', { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view view-title="{{category.name}}"> | |
<ion-content> | |
<ion-list> | |
<ion-item class="list card" ng-repeat="article in articles" type="item-text-wrap" href="#/tab/category/article/{{article.nid}}"> | |
<h2 class="title">{{article.title}}</h2> | |
<div class="item item-image"> | |
<img ng-src="{{article.image}}"> | |
</div> | |
</ion-item> | |
</ion-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view view-title="Categories"> | |
<ion-content> | |
<ion-list> | |
<ion-item class="item-icon-right" ng-repeat="category in categories" type="item-text-wrap" href="#/tab/category/{{category.tid}}"> | |
<h2>{{category.name}} ({{category.articles_count}})</h2> | |
<i class="icon ion-chevron-right icon-accessory"></i> | |
</ion-item> | |
</ion-list> | |
</ion-content> | |
</ion-view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view view-title="{{article.title}}"> | |
<ion-content class="padding"> | |
<img ng-src="{{article.image}}" class="padding"> | |
<h1>{{article.title}}</h1> | |
<article ng-bind-html="article.body"></article> | |
</ion-content> | |
</ion-view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.controller('CategoriesCtrl', ['$scope', '$ionicLoading', 'Categories', function($scope, $ionicLoading, Categories) { | |
$ionicLoading.show(); | |
Categories.all().then(function(data) { | |
$ionicLoading.hide(); | |
$scope.categories = data; | |
}, function(error) { | |
console.log(error); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.controller('ArticleDetailCtrl', ['$scope', '$stateParams', '$ionicLoading', 'Articles', function($scope, $stateParams, $ionicLoading, Articles) { | |
$ionicLoading.show(); | |
Articles.get($stateParams.articleId).then(function(data) { | |
$ionicLoading.hide(); | |
$scope.article = data[0]; | |
}, function(error) { | |
console.log(error); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.controller('ArticlesCtrl', ['$scope', 'Articles', function($scope, Articles) { | |
$scope.page = 0; | |
$scope.articles = []; | |
$scope.morePageExist = true; | |
$scope.loadMore = function() { | |
Articles.all($scope.page).then(function(data) { | |
var length = data.length; | |
if(length > 0) { |