2014-12-08 4 views
1

저는 이오니아를 처음 접했고, here 자습서에 표시된대로 ion-nav-view을 만들려고합니다. 2 페이지를 작성하고 각 구성 파일을 설정했습니다. XMLHttpRequest cannot load file:///C:/Users/ITAI/Development/Ionic/LaughWithMe/www/templates/register.html. Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.이오 네비게이션이 페이지를 불러올 수 없습니다.

app.js :

angular.module('myApp', ['ionic']) 


.config(function ($stateProvider,$urlRouterProvider) { 
// Set and define states 
$stateProvider 
    .state('register', { 
     url: '/register', 
     templateUrl: 'templates/register.html' 
    }); 
}) 

index.html을 :

<!DOCTYPE html> 
<html> 

<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
    <title></title> 

    <link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
    <link href="css/style.css" rel="stylesheet"> 

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above 
    <link href="css/ionic.app.css" rel="stylesheet"> 
    --> 

    <!-- ionic/angularjs js --> 
    <script src="lib/ionic/js/ionic.bundle.js"></script> 

    <!-- cordova script (this will be a 404 during development) --> 
    <script src="cordova.js"></script> 

    <!-- your app's js --> 
    <script src="js/app.js"></script> 
</head> 

<body ng-app="myApp"> 

    <ion-nav-bar></ion-nav-bar> 
    <ion-nav-view animation="slide-left-right"> 
    </ion-nav-view> 

<!-- <script id="index" type="text/ng-template"> 
    <!-- The title of the ion-view will be shown on the navbar --> 
    <ion-view title="'Home'"> 
    <ion-content> 
     <!-- The content of the page --> 
     <a ui-sref="register">Register</a> 
    </ion-content> 
    </ion-view> 
</script>--> 

    </body> 

</html> 

register.html :

<h1> hello world!</h1> 

I 로딩 내 브라우저에서 다음과 같은 오류가 있지만 각도에 대한 경험이 약간 있지만이 프레임 워크를 매우 혼란스럽게 생각합니다. 지시어의 위치와 HTML 페이지에 삽입하는 방법을 알 수는 없습니다. 내가 시도한 것은 register 페이지와 index.html 페이지를 연결하는 것입니다. 가장 간단한 방법이 있습니다.

답변

0

일반적으로 cors 오류는 http 서브를 사용하지 않고 프로젝트를 실행 중임을 나타냅니다. 실행 해보세요

ionic serve 
or 
phonegap serve 

프로젝트의 루트에서.

관련 문제