i cretaed new ionic blank app intuit there 2 html pages: 1 index.html , category.html. configured states , added controller in app.js file not working.
this state configurations:
.config(function($stateprovider, $urlrouterprovider) { $stateprovider .state('camera',{ url:"/camera", cache: false, controller:"cameractrl", templateurl:'index.html' }) .state('category', { url: "/category", templateurl: "category.html", controller: 'categoryctrl' }) // if none of above states matched, use fallback $urlrouterprovider.otherwise('/camera'); })
and controller:
.controller('cameractrl',function($scope,$state){ $scope.menu = function() { console.log('yesytest'); $state.go('category'); // window.location = "category.html"; }; })
this app.js. wrong here?
unfortunately had 15 minutes mock together, let me know if works , if need further assistance drop me response.
controller
var example = angular.module('starter', ['ionic', 'starter.controllers',]); example.config(function($stateprovider, $urlrouterprovider) { $stateprovider .state('tab', { url: "/tab", abstract: true, templateurl: "templates/tabs.html" }) .state('tab.home', { url: '/home', views: { 'home': { templateurl: 'templates/home.html' } } }) .state('tab.camera', { url: '/camera', views: { 'camera': { templateurl: 'templates/camera.html' } } }) .state('tab.category', { url: '/category', views: { 'category': { templateurl: 'templates/category.html' } } }); $urlrouterprovider.otherwise('/tab/home'); });