Alex Alex - 4 months ago 18
AngularJS Question

Ionic angular js

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

for example

http://plnkr.co/edit/ZWOHlCmZDxUkd4laWN4t?p=catalogue

.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'

Answer

I couldn't test my answer because your plunker is not working. I think you forgot the index.html file.

But I believe you should add to your items list the url to redirect your page :

.controller('NewsCtrl', function($scope) {           
  var items = [
    {id: 1, news_item: 'NEWS EXAMPLE', template_url : '/path/to/template'}
  ];
});

Then you can add the path to a href in your <a></a> block.

Hope it will help

Comments