# Href or ui-sref doesn't work

**URL:** <https://forum.ionicframework.com/t/href-or-ui-sref-doesnt-work/13729>\
**Category:** ionic-v1\
**Created:** [December 7, 2014, 1:43pm UTC](https://forum.ionicframework.com/t/href-or-ui-sref-doesnt-work/13729 "2014-12-07T13:43:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tintorimatteo](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tintorimatteo](https://forum.ionicframework.com/u/tintorimatteo)\
**Post date:** [December 7, 2014, 1:43pm UTC](https://forum.ionicframework.com/t/href-or-ui-sref-doesnt-work/13729/1 "2014-12-07T13:43:08Z")

</div>

I have two templates, Father.html and Detail.html. I would click on a link in the Father template and access correctly to the Detail template, but i see the previous template with overlapped the components of the next. (I tried with ui-sref) Here is the code:

(Myapp.js)  
.state(‘father’, {  
url: “/father”,  
templateUrl: “templates/father.html”,  
controller: “CtrlFather”  
})  
.state(‘detail’, {  
url: “father/detail”,  
templateUrl: “templates/detail.html”,  
controller: “CtrlDetail”  
});

(Father.html)

```
<ion-view>
...
<a ui-sref="detail">
...
</ion-view>

```

In the Detail template i haven’t used the ion-view due to an error that cause the block of the application.

Any ideas?

---

<div class="post-metadata">

**Author:** ![ghprod](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ghprod/32/64643_2.png) [@ghprod](https://forum.ionicframework.com/u/ghprod)\
**Post date:** [December 7, 2014, 2:51pm UTC](https://forum.ionicframework.com/t/href-or-ui-sref-doesnt-work/13729/2 "2014-12-07T14:51:35Z")

</div>

Could you setup codepen for your code?

---

<div class="post-metadata">

**Author:** ![tintorimatteo](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tintorimatteo](https://forum.ionicframework.com/u/tintorimatteo)\
**Post date:** [December 7, 2014, 4:42pm UTC](https://forum.ionicframework.com/t/href-or-ui-sref-doesnt-work/13729/4 "2014-12-07T16:42:10Z")

</div>

Here you are:

> <https://gist.github.com/anonymous/d76c437552370861143d#file-index-html>

---

<div class="post-metadata">

**Author:** ![tintorimatteo](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tintorimatteo](https://forum.ionicframework.com/u/tintorimatteo)\
**Post date:** [December 13, 2014, 5:03pm UTC](https://forum.ionicframework.com/t/href-or-ui-sref-doesnt-work/13729/5 "2014-12-13T17:03:15Z")

</div>

This issue was solved! I deleted various \< ion-header-bar\> and substitute it with the general \< ion-nav-bar\> and \< ion-nav-back-button\> , after that I added an abstract state for menu in myapp.js and used $stateParams for passing parameters from the parent to the son controller:

MYAPP.JS  
.state(‘menu’,{  
url:"/menu",  
templateUrl: “templates/menu.html”,  
controller: “CtrlMenu”,  
abstract=true,  
})  
.state(‘menu.father’, {  
url: “/father”,  
views: {  
‘menuV’: {  
templateUrl: “templates/father.html”,  
controller: “CtrlFather”  
}  
}  
})  
.state(‘menu.detail’, {  
url: “/detail/:id”,  
views: {  
‘menuV’: {  
templateUrl: “templates/detail.html”,  
controller: “CtrlDetail”  
}  
}  
});

SON.JS  
angular.module(…).controller(…, function(…){  
$[currentId=$stateParams.id](http://currentId=%24stateParams.id);

$scope.getElWithID = function(id){  
…  
}

$scope.getElWithID($currentId);

FATHER.HTML  
…  
{{parent.name}}

MENU.HTML  
…  
\< ion-nav-view name=“menuV”\>\< /ion-nav-view\>
