chai February 2016

Ionic project Basic Structure with angularjs?

I am new to the ionic, i started to learn ionic,i am trying to create structure for ionic, i have added the ionic links.I created the separate html files and module file and config files and all, actually i want to load the separate html file with links....i added the 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'
                  

Answers


Compa88 February 2016

Can you write your folders structure? Are you sure to have the HTML file in a folder Home? I think that your tamplateUrl is not correct!


Compa88 February 2016

Try : .state('home', { url:'/Home', templateUrl: 'views/Home/Home.html' })

TemplateUrl in the same level of URL in the json when you set the state...

Post Status

Asked in February 2016
Viewed 1,942 times
Voted 10
Answered 2 times

Search




Leave an answer