我想写下我的Javascript类.
class Option {
constructor() {
this.autoLoad = false;
}
constructor(key, value) {
this[key] = value;
}
constructor(key, value, autoLoad) {
this[key] = value;
this.autoLoad = autoLoad || false;
}
}
Run Code Online (Sandbox Code Playgroud)
我想如果我们能用这种方式写出课程会很好.期待发生:
var option1 = new Option(); // option1 = {autoLoad: false}
var option2 = new Option('foo', 'bar',); // option2 = {foo: 'bar'}
var option3 = new Option('foo', 'bar', false); // option3 = {foo: 'bar', autoLoad: false}
Run Code Online (Sandbox Code Playgroud) 我有一个用ASP.NET编写的Web API,我通过AngularJS消费$http.
我已经在我的AngularJS工厂中启用了缓存,如下所示,但每个请求仍然返回响应200,从不200 (from cache)或304(并且每个请求我的意思是在同一页面上多次发出相同的web api请求,重新访问我已经访问过的页面包含Web API请求,刷新所述页面等).
angular.module('mapModule')
.factory('GoogleMapService', ['$http', function ($http) {
var googleMapService = {
getTags: function () {
// $http returns a promise, which has a 'then' function, which also returns a promise
return $http({ cache: true, dataType: 'json', url: '/api/map/GetTags', method: 'GET', data: '' })
.then(function (response) {
return response.data;
});
};
return googleMapService;
}]);
Run Code Online (Sandbox Code Playgroud)
我是否遗漏了AngularJS方面的一些东西?或者这是一个Web API问题.或两者?
我正在开发一款应用程序,该应用程序需要在浏览器中,跨桌面和移动设备(包括Cordova的打包应用程序)对视频进行帧精确搜索.
桌面浏览器和iOS设备(包括打包应用程序和通过Safari)一样工作正常,但Android设备似乎只在视频中显示关键帧(也称为帧内帧或i帧).
我在jsfiddle上设置了一个测试页面来帮助演示我的问题.
该视频已使用ZenCoder进行编码.它的帧速率为23.976,关键帧每250帧.视频本身显示当前帧索引,因此您可以轻松地看到只有0,250和500帧的帧正在Android设备上显示,无论您在何处寻找.
在这个阶段,我会对在Android浏览器中运行的解决方案或作为Cordova的打包应用程序感到满意(我也尝试过使用Crosswalk WebView但无济于事).
使用angular和jquery我实现了slideToggle函数.为了只将这个函数应用于一个特定的HTML元素,我在ng-click函数中使用了一个参数,我的代码工作正常但是,我想知道是否存在另一种更好的方法来实现angular中的指令和ng-click函数:
的index.html
<!DOCTYPE html>
<html ng-app="myApp" ng-controller="MainController">
<head>
<title></title>
<link type="text/css" rel="stylesheet" href="css/styles.css"/>
</head>
<body>
<div>
<input type="button" ng-click="toggle('first')" value="Toggle First">
<input type="button" ng-click="toggle('second')" value="Toggle Second">
<input type="button" ng-click="toggle('third')" value="Toggle third">
<div class="div1" section="first" toggle="first" >
<p>This is section #1</p>
</div>
<div class="div1" toggle="second">
<p>This is another section #1</p>
</div>
<div class="div1" toggle="third">
<p>This is 3 section #1</p>
</div>
</div>
</body>
<footer>
<script src="js/jquery.min.js"></script>
<script src="js/angular.js"></script>
<script src="js/directives.js"></script>
</footer>
</html>
Run Code Online (Sandbox Code Playgroud)
styles.css的
.div1 {
background: Brown;
width: 200px;
height: 200px;
text-align: …Run Code Online (Sandbox Code Playgroud) 这最近才刚刚开始发生.我尝试了我可以在Stack和其他论坛上找到的所有解决方案,但迄今为止没有任何工作.
当我尝试在Azure辅助角色上开始调试时,这是我得到的:
Debug窗口显示: The program '[2208] WaIISHost.exe' has exited with code 0 (0x0).
我在管理模式下运行Visual Studios,将正确的项目设置为启动并使用IIS Express作为开发服务器.
我尝试使用相同的基础项目创建一个新的Azure辅助角色,但这不起作用.系统事件日志没有任何信息.我已经尝试重新安装VS2015并单独重新安装Azure SDK(v.2.7.1),没有任何更改.当我查看计算模拟器时,它在消失之前说:
[fabric] Role Instance: deployment27(250).Web.0
[fabric] Role state Unhealthy
[fabric] Role state Stopped
Run Code Online (Sandbox Code Playgroud)
然而,我能够在解决方案中启动其他工作者角色项目,这使我相信某些项目必然会在某种程度上与破坏的工作者角色相关联.我在这个阶段没有想法,所以非常感谢任何帮助.
UPDATE
查看WallSHost.log里面的文件C:\Users\<UserAccount>\AppData\Local\dftmp\Resources\<GUID>\directory\DiagnosticStore给我一个Invalid name错误:
WaIISHost Information: 0 : [00003568:00000001, 2015-10-06 20:02:05.472, INFO ] Attempt Deploy with RoleInstanceId=deployment27(252).Web_IN_0 RoleRoot=C:\Web\csx\Debug\roles\Web\ optional SitesDestination=
WaIISHost Information: 0 : [00003568:00000001, 2015-10-06 20:02:08.153, ERROR] Exception:System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Invalid name.
Parameter name: name (Fault Detail is equal to An ExceptionDetail, likely created by …Run Code Online (Sandbox Code Playgroud) 有没有办法在Angular中实现jQuery的Quicksand插件?也许有一个实现,但我似乎无法找到它.
也许这样做的策略会对我有所帮助,因为流沙会获取一个列表然后作为参数接收新列表,但是使用Angular重新呈现数据的方式我不知道如何做到这一点.
我正在研究一个DDD项目,其中正在进行大量的字段映射.我正在寻找一个快速而可靠的映射库,而不是手工编写所有映射,并且似乎有很多选项.
目前我更倾向于Glue,因为它看起来提供了相当多的功能,并且还考虑了单元测试,这对我正在进行的项目也很重要.在不利方面,它只下载了200多次,这让我觉得像ValueInjecter这样的东西可能是更好的选择,因为它有更多的支持.
我的问题是,Glue比其他任何一个地图制作者更好还是更差?或者上面提到的映射器之间的差异在性能和可用性方面可以忽略不计?
这是我的控制器:
angular.module('domiciliations').controller('mandatsCtrl', ['$scope', 'Domiciliation', 'logger', function ($scope, Domiciliation, logger) {
$scope.mandats = Domiciliation.query();
$scope.fullName = function () {
return this.Person ? 'test' : 'test2'
}
$scope.isNextDisabled = function () {
return false;
}
$scope.isPrevDisabled = function () {
return true;
}
$scope.next = function () {
logger.info("test");
}
}]);
Run Code Online (Sandbox Code Playgroud)
缩小时,我收到一个错误:
Error: Unknown provider: nProvider <- n
Run Code Online (Sandbox Code Playgroud)
现在,如果我在控制器之后包含以下行,那么它可以工作:
mandatsCtrl.$inject = ['$scope', 'Domiciliation', 'logger'];
Run Code Online (Sandbox Code Playgroud)
我认为在控制器函数中使用数组类型声明的重点是避免使用$ inject ....我是否错过了什么?
我正在尝试为我的项目添加一个模态,所以我找到了这个库:ng2-bootstrap
我首先使用命令安装它: npm install ng2-bootstrap --save
我的班级看起来像:
import { Directive, ElementRef, Input, Renderer, AfterViewInit, OnDestroy } from
@angular/core';
import { ModalModule } from 'ng2-bootstrap/ng2-bootstrap';
@Directive({
selector: '[bsModal]',
exportAs: 'bs-modal'
})
export class ModalDirective implements AfterViewInit, OnDestroy {
@Input()
public set config(conf:ModalOptions) {
this._config = this.getConfig(conf);
};
@Output() public onShow:EventEmitter<ModalDirective> = new EventEmitter();
@Output() public onShown:EventEmitter<ModalDirective> = new EventEmitter();
@Output() public onHide:EventEmitter<ModalDirective> = new EventEmitter();
@Output() public onHidden:EventEmitter<ModalDirective> = new EventEmitter();
}
Run Code Online (Sandbox Code Playgroud)
但我得到了这个错误:
class 'ModalDirective' incorrectly implements interface 'AfterViewInit'
angularjs ×4
c# ×2
javascript ×2
jquery ×2
android ×1
angular ×1
asp.net ×1
automapper ×1
azure ×1
caching ×1
class ×1
constructor ×1
cordova ×1
ecmascript-6 ×1
ffmpeg ×1
html5-video ×1
mapper ×1
quicksand ×1
slide ×1
slidetoggle ×1