I can't get my data using $stateParams

Hi there!!
I have a problem to view my selected Task in ionic but in my web app it works perfectly because i have list of task in the right and when i clicked specific task it display the selected Task in the left side
but in ionic i create another view for specific task and i get the id in the url but the data not display…!!

This is my code …


app.controller(‘browseDetailCtrl’, function($scope,$ionicPopup, $stateParams, Auth,Task) {

$scope.tasks = Task.all;

$scope.user = Auth.user;
$scope.signedIn = Auth.signedIn;

if($stateParams.taskId) {
var task = Task.getTask($stateParams.taskId).$asObject();

function setSelectedTask(task) {
$scope.selectedTask = task;


.state(‘tabsController.browse’, {
url: ‘/browse’,
views: {
‘tab1’: {
templateUrl: ‘templates/browse.html’,
controller: ‘browseCtrl’

.state('tabsController.browseDetail', {
  url: '/browseDetail/:taskId',
  views: {
    'tab1': {
      controller: function($stateParams){


app.factory(‘Task’, function(FURL,$firebaseObject,$firebaseArray, Auth) {
var ref = new Firebase(FURL);
var tasks = $firebaseArray(ref.child(‘tasks’));
var user = Auth.user;

var Task = {
all: tasks,

getTask: function (taskId) {
  return $firebaseObject(ref.child('tasks').child(taskId));

createTask: function (task) {
  task.datetime = Firebase.ServerValue.TIMESTAMP;
  return tasks.$add(task)
    .then(function(newTask) {
      // Create User-Tasks lookup record for POSTER
      var obj = {
        taskId: newTask.key(),
        type: true,
        title: task.title

      return $firebaseObject(ref.child('user_tasks').child(task.poster)).$push(obj);

my browseDetail.html

  <div   class="row button-bar button-small button-block ">
    <a class="button button-assertive col-50">إلغاء</a>
    <a class="button button-assertive col-50" ng-click="editTask()">تعديل</a>

  <div class="list card">
        <div class="item item-avatar-right">
            <img ng-src="{{ selectedTask.gravatar }}">
          <h2 dir="rtl">           أرسلت بواسطة  {{selectedTask.name}} -noor</h2>
            <button class="button  button-positive button-small {{selectedTask.status}}">{{ selectedTask.status }}</button>
            <p  dir="rtl"  am-time-ago="selectedTask.datetime"></p>
    <div dir="rtl" class="list card">
        <div class="item item-divider">بيانات المعلم</div>
        <div class="item item-body">
            <ion-list >
                <ion-item>{{selectedTask.school}}المدرسة :</ion-item>
                <ion-item>{{selectedTask.grade}}المرحلة :</ion-item>
                <ion-item>{{selectedTask.governorate}}المحافظة :</ion-item>
                <ion-item>{{selectedTask.wilayat}}الولاية :</ion-item>
                <ion-item>{{selectedTask.residential}}المنطقة السكنية :</ion-item>

any help!!