小编Vin*_*ian的帖子

Angular Js路由谷歌Chrome问题

使用下面提到的Code1在角度Js中进行基本路由并获得" XMLHttpRequest无法加载交叉源请求仅支持协议方案:http,数据,chrome扩展,https,chrome-extension-resource "错误并且我们必须使用本地Web服务器解析相同的和下载的MAMP并保持我的html [login.html]在htdocs文件夹中启动服务器并用Code2中提到的[localhostURL/AngularJs/login.html']替换templateUrl并获得错误错误:[ $ sce:insecurl]下面给出了确切的错误,指导我在Google Chrome中修复相同的解决方案...

代码1

的index.html

<!DOCTYPE html>
 <html>
    <head>
    <title>Test</title>
    </head>
    <body ng-app="plunker">
    <div ng-view=""></div>    
    <script src="angular.min.js"></script>
    <script src="angular-route.js"></script>
    <script src="app.js"></script>  
   </body>
 </html>
Run Code Online (Sandbox Code Playgroud)

app.js

  var app = angular.module('plunker', ['ngRoute']);
  app.config(function ($routeProvider) {
  $routeProvider.when('/login',{
        controller: '',
        templateUrl: 'login.html'
    }).otherwise({ 
        redirectTo: '/login' 
    });
 });
Run Code Online (Sandbox Code Playgroud)

的login.html

   Hello from login! 
Run Code Online (Sandbox Code Playgroud)

码2

所有其他事情都与app.js中的更改相同

   var app = angular.module('plunker', ['ngRoute']);
   app.config(function ($routeProvider) {
   $routeProvider.when('/login',{
        controller: '',
        templateUrl: 'http://localhost:8888/AngularJs/login.html'
    }).otherwise({ 
        redirectTo: '/login' 
    });
});
Run Code Online (Sandbox Code Playgroud)

错误代码1: - XMLHttpRequest cannot load file://localhost/Users/karthicklove/Documents/Aptana%20Studio%203%20Workspace/Object_Javascript/Angular_Js/Routing/login.html. Cross …

cross-domain angularjs angular-ui-router

8
推荐指数
2
解决办法
2万
查看次数

如何在CQ5中使用cq:includeClientLib来包含CSS和Javascript

使用clientLibrary [cq:includeClientLib]的CQ5中的js和css包含了哪些概念?有一个屏幕截图的例子会很棒.

javascript css aem

5
推荐指数
1
解决办法
9374
查看次数