Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Detail View

$
0
0

Solved it!
Here's my code:

controller.js

app.controller('SuggestionsCtrl', ['$scope', 'suggestionService', '$state', function($scope, suggestionService, $state){
	$scope.suggestionId = $state.params.suggestionId;

	suggestionService.getAll()
	.success(function(data) {
		$scope.suggestions = data;
	});

	suggestionService.get($scope.suggestionId)
	.success(function(data) {
		$scope.suggestion = data;
	});

service.js

app.factory('suggestionService', ['$http', function($http) {

	var baseUrl = 'path_to_data';

	return {
		getAll: function() {
			return $http.get(baseUrl);
		},

		get: function (id) {
			return $http.get(baseUrl + '/id=' + id);
		}
	}

detail.html

<ion-item ng-repeat="detail in suggestion | filter: {id:suggestionId}">
    <img ng-src="{{ detail.titelbildUrl }}" class="full-width">
    <h2>{{ detail.titel }}</h2>
    <p>{{ detail.beschreibung }}</p>
  </ion-item>
</ion-list>

Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>