Ionic project Basic Structure with angularjs? -
i new ionic, started learn ionic,i trying create structure ionic, have added ionic links.i created separate html files , module file , config files , all, want load separate html file links....i added code bellow..
index.html
<!doctype html> <html ng-app="someapp"> <head> <meta charset="utf-8"> <title>app</title> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <link data-require="ionic@1.0.0-beta.1" data-semver="1.0.0-beta.1" rel="stylesheet" href="http://code.ionicframework.com/1.0.0-beta.13/css/ionic.css" /> <script data-require="ionic@1.0.0-beta.1" data-semver="1.0.0-beta.1" src="http://code.ionicframework.com/1.0.0-beta.13/js/ionic.bundle.js"></script> <script src="module.js"></script> <script src="js/core/config.js"></script> <script src="js/controllers/workctrl.js"></script> </head> <body> <ion-view></ion-view> </body> </html> module.js
var ionapp = angular.module("someapp",['ionic']); config.js
ionapp.config(function($stateprovider,$urlrouterprovider){ $stateprovider .state('home', { url:'/home', views: { 'menucontent': { templateurl: 'views/home/home.html' } } }) .state('work', { url:'/work', views: { 'menucontent': { templateurl: 'views/home/work.html' } } }) .state('personal', { url:'/personal', views: { 'menucontent': { templateurl: 'views/home/personal.html' } } }) $urlrouterprovider.otherwise('/home'); }); home.html
<ion-view> <ion-content> <button ng-click="gotowork()">work</button> <button ng-click="gotopersonal()">personal</button> hello </ion-content> </ion-view> work.html , personal.html
//some matter here in 2 html files... workctrl.js
ionapp.controller(function($scope,$location){ $scope.gotowork = function(){ $location.path("/work"); }; $scope.gotopersonal = function(){ $location.path("/personal"); }; }); i trying load first home.html file....but displaying white page without errors can u please reply 1 if did wrong in code..
thank you
can write folders structure? sure have html file in folder home? think tamplateurl not correct!
Comments
Post a Comment