angularjs - Controller is loaded but Templaturl (View) doesn't load -
note: please don't mark duplicate. i'm putting note on first line, because know question has been asked lot of times on so. have gone through of them without finding solution.
here state configuration of app.js:
.config(function($stateprovider, $urlrouterprovider) { // ionic uses angularui router uses concept of states // learn more here: https://github.com/angular-ui/ui-router // set various states app can in. // each state's controller can found in controllers.js $stateprovider .state('intro', { url: "/intro", templateurl: "intro.html", controller: 'introctrl' }) .state('accedituser', { url: '/user', //templateurl : 'templates/followersliding.html', templateurl: 'tab-account.html', controller: 'edituserctrl' }) .state('welcome', { url: "/welcome", templateurl: "partials/welcome.html", controller: 'welcomectrl' }) .state('index', { url: '/index', templateurl: 'slidingtabs.html', controller: 'userctrl' }) .state('index.account', { url: '/account/:userid', views: { 'index-account': { templateurl: 'tab-user.html', controller: 'userctrl' } } }) .state('index.home', { url: '/home', views: { 'index-home': { templateurl: 'tab-post-list.html', controller: 'postsctrl' } } }) .state('index.post-detail', { url: '/post/:id', views: { 'index-posts': { templateurl: 'post-detail.html', controller: 'postsctrl' } } }) .state('index.addpost', { url: '/addpost/:id', views: { 'index-addpost': { templateurl: 'add-post.html', controller: 'myctrl' } } }) .state('index.image', { url: '/image/:id', views: { 'index-image': { templateurl: 'image.html', controller: 'myctrl' } } }) .state('index.chats', { url: '/chats', views: { 'index-chats': { templateurl: 'tab-clomastocash.html', controller: 'ccctrl' } } }) .state('index.chat-detail', { url: '/chats/:chatid', views: { 'index-chats': { templateurl: 'chat-detail.html', controller: 'ccdetailctrl' } } }) .state('index.collections', { url: '/collections', views: { 'index-collections': { templateurl: 'tab-collections.html', controller: 'collectionsctrl' } } }) .state('index.vendors', { url: '/vendors', views: { 'index-vendors': { templateurl: 'tab-vendors.html', controller: 'vendorsctrl' } } }) .state('index.vendor-detail', { url: '/vendors/:vendorid', views: { 'index-vendors': { templateurl: 'vendor-detail.html', controller: 'vendorsdetailctrl' } } }) .state('index.search', { url: '/search', views: { 'index-search': { templateurl: 'tab-search.html', controller: 'searchallctrl' } } }) .state('search.stores', { url: '/stores', views: { 'search-stores': { templateurl: 'tab-vendors.html', controller: 'searchallctrl' } } }) .state('search.people', { url: '/people', views: { 'search-people': { templateurl: 'tab-people.html', controller: 'searchallctrl' } } }) .state('search.products', { url: '/products', views: { 'search-products': { templateurl: 'tab-vendors.html', controller: 'searchallctrl' } } }) // if none of above states matched, use fallback // $urlrouterprovider.otherwise('/tab/post'); $urlrouterprovider.otherwise('/index/home'); //$urlrouterprovider.otherwise("/welcome"); });
i have peculiar problem route index.account
i'm trying load within search.people this:
<a class="tab-item" href="#/index/account/{{person.id}}" ></a>
url changes, code within userctrl, controller index.account gets invoked. templateurl doesn't loaded.
i tried calling $state.go inside ng-click instead of href, doesn't work.
if same in of 'index.' routes, works. think there problem in loading 'index.' routes within 'search.'
please help. may doing conceptually wrong here.
edit 1 app.js in 'js' folder & html in 'templates' folder
i'm using templates-cache, templates merge 1 templates.js file, why in templateurl haven't prefixed 'templates/'
here directory structure: directory of e:\programming\nodejs\ion2\www
09/25/2015 11:06 pm <dir> . 09/25/2015 11:06 pm <dir> .. 10/04/2015 10:57 <dir> css 09/16/2015 01:21 pm <dir> dist 09/06/2015 08:01 pm <dir> fonts 09/06/2015 08:01 pm <dir> img 09/15/2015 01:59 pm 170 index.html 10/10/2015 01:33 pm <dir> js 09/06/2015 08:01 pm <dir> lib 08/02/2015 03:17 pm 99 logoutcallback.html 09/25/2015 11:06 pm 7,134 main.html 08/02/2015 03:17 pm 137 oauthcallback.html 09/06/2015 08:01 pm <dir> partials 08/20/2015 10:22 27,844 selection.json 10/10/2015 12:49 pm <dir> templates 08/02/2015 03:17 pm 318 web.config
Comments
Post a Comment