Hi guys,
Actually, I can solve with ui-sref attribute but I should do with ng-click function because I going to use $http.post in this function. My codes as short like this following;
var app = angular.module('myApp', ['ionic']);
app.config(function($stateProvider, $urlRouterProvider){
$stateProvider.state('main',{
url: '/main',
templateUrl: 'main.html'
}).state('yonetimPaneli',{
url: '/yonetimPaneli',
templateUrl: 'yonetimPaneli.html',
contoller:"yonetimCtrl"
}).state('sozlesmeSayfasi',{
url: '/sozlesmeSayfasi',
templateUrl: 'sozlesmeSayfasi.html'
});
$urlRouterProvider.otherwise('/main');
});
app.controller('yonetimCtrl',function($scope,$state){
$scope.sozlesmeSayfasiOpen = function(){
$state.go('sozlesmeSayfasi');
}
});
Ionic HTML is following;
<body ng-app="myApp">
<ion-nav-view></ion-nav-view>
<script id="main.html" type="text/ng-template"></script>
<script id="sozlesmeSayfasi.html" type="text/ng-template"></script>
<script id="yonetimPaneli.html" type="text/ng-template">
<button class="button button-block button-balanced" ng-click="sozlesmeSayfasiOpen()">
Open it
</button>
</script>
</body>
That’s all. Do not worry, main.html and sozlesmeSayfasi.html are full. I was think my problem for not require.
Where is the my mistake ? I could not solve this. ui-sref is working in same codes. sozlesmeSayfasiOpen() function does not work, I was just add console.log in it, It does not show anything. And,
- I was try $timeout function in $state.go is does not work.
- I was just try console.log or sample alert function but does not work.
Thank you for interest.
Best regards…
Note: I am using ionic.bundle. So I am developping mobile application in Intel XDK over Ubuntu.
Update 1
I was solved is mistake. Does not work $stateProvider.state in controller attribute so it is not add auto controller. I was add controller with manually.
What do you think this problem ? Why do not auto add ?