Path route view to view by id

Hello guys im struggeling with ionic and angular i build an news site view with thumbnail menu i wrote my news in an array

for example

code example

 .controller('NewsCtrl', function($scope) {

    var items = [
        {id: 1, news_item: 'NEWS EXAMPLE'}


how can i route the right path to the news_item.html site which i klicked on. so if i click on first one i get the tempalte with ‘NEWS EXAMPLE’

You should user url paramemters i.e

route settings:

.state('NewsDetails', {
        url: '/NewsDetails/:newsID',
        templateUrl: '/NewsDetails.html',
        controller: 'NewsDetailsCtrl'


.controller('NewsDetailsCtrl', function($scope, $stateParams) {
   var news_id = $stateParams.newsID;

use like this:
e.g /NewsDetail/1
Hope that helps.

1 Like

Thank u so much u made my day :smile: