GVKun编程网logo

windows-8 – 使用AngularJS for Windows Store App“无法添加动态内容”,但它确实有效

18

在这里,我们将给大家分享关于windows-8–使用AngularJSforWindowsStoreApp“无法添加动态内容”,但它确实有效的知识,同时也会涉及到如何更有效地angularjs–如何在

在这里,我们将给大家分享关于windows-8 – 使用AngularJS for Windows Store App“无法添加动态内容”,但它确实有效的知识,同时也会涉及到如何更有效地angularjs – 如何在Windows 7上安装Angular、AngularJS 文件上传抛出 403 Forbidden - IIS Windows Server、AngularJS和Windows 8路由错误、AppEngine SDK for Windows和Windows上的Ubuntu上的Bash的内容。

本文目录一览:

windows-8 – 使用AngularJS for Windows Store App“无法添加动态内容”,但它确实有效

windows-8 – 使用AngularJS for Windows Store App“无法添加动态内容”,但它确实有效

我正在使用AngularJS创建一个 Windows应用商店应用(或城域应用,或者他们称之为的任何应用).

我解决了Javascript RunTime错误“无法添加动态内容”崩溃应用程序(见here),一切顺利,直到我开始使用指令(undestand angular.module.directive).

现在,我有一个“无法添加动态内容”但在控制台日志中.请注意,应用程序不会崩溃,事实上,应用程序按预期工作!

我应该忽略错误(我不喜欢),我可以做些什么吗?

一个“时钟”应用程序的代码来说明:
该应用确实显示了正确的时间,格式化和每秒递增. DOM就是我所期望的.

谢谢,

index.html的:

<!doctype html>
<html lang="en" ng-app="phonecat">
<head>
<Meta charset="utf-8">
<title>Google Phone gallery</title>
<link rel="stylesheet" href="css/app.css">
<link rel="stylesheet" href="css/bootstrap.css">

<script src="lib/jquery-1.8.2-win8-1.0.min.js"></script>
<script type="text/javascript">
    jQuery.isUnsafe = true;
</script>
<script src="lib/angular/angular.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/filters.js"></script>
<script src="js/services.js"></script>
<script src="lib/angular/angular-resource.js"></script>
</head>

app.js

angular.module('phonecat',['phonecatFilters','phonecatServices']).config(['$routeProvider',function($routeProvider) {
  $routeProvider.
      when('/phones',{templateUrl: 'partials/phone-list.html',controller: PhoneListCtrl}).
      otherwise({redirectTo: '/phones'});
  }])
.directive('myCurrentTime',function($timeout,datefilter) {
    return {
        restrict: 'E',replace: true,template: '<div> Current time is: <span>{{time}}</span></div>',link: function (scope,element,attrs) {
            var timeoutId;

            function updateTime() {
               scope.time = datefilter(new Date(),'M/d/yy h:mm:ss a');
            }

            function updateLater() {
                timeoutId = $timeout(function () {
                    updateTime();
                    updateLater();
                },1000);
            }

            element.bind('$destroy',function () {
                $timeout.cancel(timeoutId);
            });

            updateLater();
        }
    }
});

错误:

HTML1701: Unable to add dynamic content '<my-current-time></my-current-time>
'. A script attempted to inject dynamic content or elements prevIoUsly modified dynamically that might be unsafe. For example,using the innerHTML property to add script or malformed HTML will generate this exception. Use the toStaticHTML method to filter dynamic content or explicitly create elements and attributes with a method such as createElement. For more information,see http://go.microsoft.com/fwlink/?LinkID=247104.
File: index.html

解决方法

这是窗口商店应用程序的安全性.
您可以使用以下 script修复它.

angularjs – 如何在Windows 7上安装Angular

angularjs – 如何在Windows 7上安装Angular

嗨,这应该是非常直接但我会卡住.我在我的机器上安装了buildbot(0.9.06b)和 Windows 7机器.我已设法启动并运行但是当我尝试显示网页(IE8)时,我得到错误Angular未定义.这是一个全新的窗户盒我不是太惊讶.我继续下载NodeJS可执行文件并在机器上运行它,以便安装Node.然后我去了 Angular website下载了zip文件,但我不确定下一步该做什么?
我试过了

npm install Angular

以及一些变体,即指定版本,解压缩文件.但还是无法安装它.
我的机器在防火墙后面,所以它不能只是去网上获取更多东西.这一切都必须在当地工作.
我该如何安装Angular?
如何检查Angular是否已安装?

问候

TL; DR

使用Node,Angular,Express和Bower查看this github repo作为示例工作应用程序.

您接收Angular未定义消息的原因是因为您没有从Web服务器向客户端提供Angular.

从npm安装Angular通常意味着你将从你的node_modules文件夹中提供它,或者你将使用Browserify.我建议不要使用npm install –save angular,你的node_modules应该只包含服务器端依赖项,如果你是在大多数情况下不使用browserify.此外,NPM软件包使用Commonjs,即isn’t preferred in the browser. browserify是一种流行的解决方案,用于编写可以捆绑到浏览器兼容的js文件中的Commonjs样式代码.他们有docs起床和跑步.

或者,您可以从Bower.io安装Angular .Bower是客户端软件包的软件包管理器. Bower有一个huge package library,包括许多也可以通过NPM获得的套餐.

还值得一提的是,除非您正在为全局安装执行npm install -g,否则在执行npm安装或为项目依赖项执行npm卸载时应添加–save标志. –save将您安装的所有软件包添加到package.json文件中作为依赖项.

这是一个如何从Node.js提供Angular的示例

这个例子只使用Node.js,Express,EJS(用于Express View引擎渲染),Bower&角

npm install -g bower
cd <your project directory>  

// answer questions about your project
// this will create your package.json file
npm init 
npm install --save express
npm install --save ejs

// answer the questions about your project
// this will create your bower.json file
bower init 
bower install --save angular

目录结构

- Project Folder
  - node_modules
  - bower_components
  - public
    - app
      - app.js
  - views
    - index.html
  - bower.json
  - package.json
  - server.js

Angular App – public / app / app.js

// This is a super simple Hello World AngularJS App
(function() {
  angular
    .module('yourApp',[])
    .controller('YourController',['$scope',function($scope) {         
      $scope.hello = 'Hello World';
    }]);
})();

Angular必须像任何其他客户端库一样加载,因此它需要包含在< head>内的页面中.标签.

视图 – views / index.html

<html>
  <head>
    <!-- load Angular into our HTML Page -->
    <script src="/bower_components/angular/angular.js"></script>
    <!-- load our Angular App in -->
    <script src="/public/app/app.js"></script>
  </head>
  <body ng-app="yourApp">
    <div ng-controller="YourController">
      {{ hello }}
    </div>
  </body>
</html>

为了实现这一点,您需要实际运行一个Web服务器,以便在您调用它们时为您正在寻找的文件提供服务.您可以使用Express执行此操作.

Node.js Web服务器 – server.js

var express = require('express);
var path = require('path');
var app = express();


// Setup View Engines
app.set('views',path.join(__dirname,'views'));
app.engine('html',require('ejs').renderFile);
app.set('view engine','html');

// Serve files from your "public" directory
app.use('/public',express.static(path.join(__dirname + 'public)));

// Serve files from your "bower_components" directory
app.use('/bower_components',express.static(path.join(__dirname + '/bower_components')));

// GET index.html route
app.get('/',function(req,res) {
  return res.render('index');
});

// Start our server and start to listen
app.listen(process.env.PORT || 3000,function() {
  console.log('listening');
});

现在您需要做的就是节点server.js,并在localhost或您指定的任何地方访问您的站点,您应该启动并运行.

AngularJS 文件上传抛出 403 Forbidden - IIS Windows Server

AngularJS 文件上传抛出 403 Forbidden - IIS Windows Server

如何解决AngularJS 文件上传抛出 403 Forbidden - IIS Windows Server?

在我的应用程序中,我使用 AngularJS 文件上传来读取上传的 excel 文件。在我的控制器中,我有如下上传方法,

Upload.upload({
         url: ''upload/url'',file: file
   }).progress(function (evt) {
      console.log("Progress");
   }).success(function (data,status,headers,config) {
      console.log("Success");
   });
 });

但是此 Upload.upload 失败并显示以下消息

Possibly unhandled rejection: {"data":"<html>\r\n<head><title>403 Forbidden</title></head>\r\n<body>\r\n<center><h1>403 Forbidden</h1></center>\r\n</body>\r\n</html>\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n","status":403,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"upload/url","file":{},"_isDigested":true,"_chunkSize":null,"headers":{"Accept":"application/json,text/plain,*/*","Authorization":"Bearer <token>"},"_deferred":{"promise":{}},"cached":false},"statusText":"","xhrStatus":"complete"}

我尝试验证对源代码可用文件夹的 IIS_Users 的完全访问权限。

帮助我解决问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

AngularJS和Windows 8路由错误

AngularJS和Windows 8路由错误

我正在尝试在带有Visual Studio 2012的Windows 8.1上使用angularJS创建HTML5 / JS /
CSS3应用程序。我目前无法将参数发送到其他视图。

谷歌搜索时,我看到几个示例,<a href="#/page/{{:pageId}}">link</a>当我在Windows
8应用程序中执行此操作并单击链接时,出现以下错误。

未安装任何应用程序以打开此类链接(不安全)

当我将{{:pageId}}代码放在A标签之间时,它会显示其ID。

app.js

var myApp = angular.module(''myApp'', [''ngRoute'', ''ngResource'']);myApp.config([''$routeProvider'', function($routeProvider) {    $routeProvider.when("/", { templateUrl: "views/home.html" })        .when("/page/:pageId", { templateUrl: "views/page.html" })        .otherwise({ redirectTo: "/" });}]);

有什么解决方案可以解决这个问题?

-更新-

我已经做了一些调试。在浏览器中,一切正常。在Visual Studio中,我发现了以下内容:

<ahref="unsafe:ms-appx://3595d292-0235-47cd-8db7-cb3019f29114/www/index.html#/page/1" data-ng-href="#/page/1">Select</a>

好像VS在添加一些代码。在源代码中,我没有包含href项目

我已经更改了链接,并且一切似乎都很好,并且只有VS不断在链接的开头添加’unsafe:’时,才加载正确的变量。

答案1

小编典典

问题解决了!

似乎由ms正在添加的ms-appx导致了问题。通过添加以下代码来解决此问题。

AngularJS 1.2

app.config([''$compileProvider'', function($compileProvider) {  $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|file|ms-appx):/);}]);

对于1.1.x和1.0.x,请使用urlSanitizationWhitelist。

如果使用PhoneGap,请记住添加https?以外的文件,否则,链接将不起作用。

AppEngine SDK for Windows和Windows上的Ubuntu上的Bash

AppEngine SDK for Windows和Windows上的Ubuntu上的Bash

我正在尝试在Windows上的Ubuntu的Bash上使用AppEngine SDK进行Go,但是我有一个错误。 这是我的代码。

的app.yaml

runtime: go api_version: go1 handlers: - url: /.* script: _go_app

main.go

package main import ( "net/http" "github.com/labstack/echo" "github.com/labstack/echo/engine/standard" ) func init() { e := echo.New() e.GET("/",func(c echo.Context) error { return c.String(http.StatusOK,"Hello,World!") }) s := standard.New("") s.SetHandler(e) http.Handle("/",s) }

这里是错误和命令。

如何正确地等待事件/过程完成不是父母?

如何打包一个Go程序,使其自给自足?

去HTTP服务器testingab vs wrk结果有很大的差别

以编程方式检测Windows 7上是否启用硬件虚拟化

如何在Linux上编译跨平台的Go语言项目?

surface@DESKTOP-U7N4QNQ:~/projects$ goapp serve INFO 2016-08-09 14:24:35,574 devappserver2.py:769] Skipping SDK update check. INFO 2016-08-09 14:24:35,665 api_server.py:205] Starting API server at: http://localhost:38070 INFO 2016-08-09 14:24:35,670 api_server.py:648] Applying all pending transactions and saving the datastore INFO 2016-08-09 14:24:35,671 api_server.py:651] Saving search indexes Traceback (most recent call last): File "/home/surface/dev/go_appengine/dev_appserver.py",line 89,in <module> _run_file(__file__,globals()) File "/home/surface/dev/go_appengine/dev_appserver.py",line 85,in _run_file execfile(_PATHS.script_file(script_name),globals_) File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py",line 1040,in <module> main() File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py",line 1033,in main dev_server.start(options) File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py",line 824,in start self._dispatcher.start(options.api_host,apis.port,request_data) File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/dispatcher.py",line 194,in start _module.start() File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/module.py",line 1180,in start self._watcher.start() File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/inotify_file_watcher.py",line 220,in start self._add_watch_for_path(directory) File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/inotify_file_watcher.py",line 205,in _add_watch_for_path raise error OSError: [Errno 22] EINVAL: '/home/surface/projects' error while running dev_appserver.py: exit status 1 surface@DESKTOP-U7N4QNQ:~/projects$

我没有任何想法来解决这个问题。 我认为这是一个SDK的问题。

在GO中找不到软件包“gopkg.in/validator.v2”错误

libgit2高山linux泊坞错误

我需要使用Nginx还是Apache来使用Lets Encrypt?

只接受来自Go的Localhost的HTTP连接?

如何在Golang中使用COM(组件对象模型)

我自己得到了答案。

这个问题发生在Windows上的Ubuntu的Bash上。

它不支持File Watcher。 (已经有人提出了一个问题https://github.com/Microsoft/BashOnWindows/issues/216 )

因此,我使用dev_appserver.py和--use_mtime_file_watcher=true选项。

这是我的完整命令,完美的作品。

$ dev_appserver.py --use_mtime_file_watcher=true /home/surface/projects/

谢谢。

关于windows-8 – 使用AngularJS for Windows Store App“无法添加动态内容”,但它确实有效的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于angularjs – 如何在Windows 7上安装Angular、AngularJS 文件上传抛出 403 Forbidden - IIS Windows Server、AngularJS和Windows 8路由错误、AppEngine SDK for Windows和Windows上的Ubuntu上的Bash等相关知识的信息别忘了在本站进行查找喔。

本文标签: