使用ui-router的AngularJS应用程序.我的列表页面加载正确,但是当点击列表页面上的链接时,我的网址会更改但页面上的html不会更改,它会保留在列表页面上.这个路由有什么问题?
app.js
var myApp = angular.module('myApp', ['ui.router']);
myApp.config([
'$stateProvider', function($stateProvider) {
$stateProvider
.state('products', {
url: '',
templateUrl: 'Scripts/templates/manageProducts/products.list.html',
controller: 'productListCtrl'
})
.state('products.detail', {
url: '/:id',
templateUrl: 'Scripts/templates/manageProducts/products.detail.html',
controller: 'productDetailCtrl'
});
}
]);
Run Code Online (Sandbox Code Playgroud)
的index.html
<div ng-app="myApp">
<div ui-view></div>
</div>
Run Code Online (Sandbox Code Playgroud)
在products.list.html模板上:
<a ui-sref="products.detail({ id: 1 })">Detail for Item 1</a>
Run Code Online (Sandbox Code Playgroud)
我应该使用UI路由器吗?列表和详细信息页面是2个不同的屏幕.
我有自定义验证的指令(验证用户名尚不存在).验证使用$ http服务询问服务器是否存在用户名,因此返回是一个promise对象.这对验证非常有用.表单无效并包含myform.$ error.usernameVerify已经使用用户名.但是,user.username始终未定义,因此它违反了我的ng-model指令.我认为这可能是因为.success中的函数正在创建自己的范围,并且控制器$ scope上没有使用返回值.我如何解决这个问题,以便ng-model绑定仍然有效?
commonModule.directive("usernameVerify", [
'userSvc', function(userSvc) {
return {
require: 'ngModel',
scope: false,
link: function(scope, element, attrs, ctrl) {
ctrl.$parsers.unshift(checkForAvailability);
ctrl.$formatters.unshift(checkForAvailability);
function checkForAvailability(value) {
if (value.length < 5) {
return value;
}
// the userSvc.userExists function is just a call to a rest api using $http
userSvc.userExists(value)
.success(function(alreadyUsed) {
var valid = alreadyUsed === 'false';
if (valid) {
ctrl.$setValidity('usernameVerify', true);
return value;
}
ctrl.$setValidity('usernameVerify', false);
return undefined;
});
}
}
}
}
]);
Run Code Online (Sandbox Code Playgroud)
这是我的模板:
<div class="form-group" ng-class="{'has-error': accountForm.username.$dirty …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Swagger + Swashbuckle设置Api应用程序(Azure),如Scott Hanselman在// Build会议上所示:http://channel9.msdn.com/Events/Build/2015/2-628.
我已经安装(使用NuGet)包Swagger.Api和Swashbuckle.Core.它没有添加任何我想要的控制器或设置,以便有一个昂首阔步的页面.当我导航到{baseUrl}\swagger时,我收到404错误.
我认为,由于它有一个UI,除了Api应用程序之外还需要一个Web应用程序,但是我已经重新编写了演示,Scott明确表示你可以在任何Api应用程序中添加Swagger + Swashbuckle.在第二个应用程序中,虽然我认为Api发现可能存在问题.有没有人成功设置过这个?

我正在尝试使用非管理员帐户(使用Web Deploy 3.0)部署ASP.net MVC网站.根据我见过的所有视频和文档,这是可能的.但是,当我尝试部署时,我收到错误(ERROR_USER_NOT_ADMIN).
我在服务器上的"IIS管理用户"下添加了用户.此用户存在于"IIS管理器权限"下的站点上.
我错过了什么?
这是pubxml:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<SiteUrlToLaunchAfterPublish>http://sitename.com/</SiteUrlToLaunchAfterPublish>
<MSDeployServiceURL>http://server.com</MSDeployServiceURL>
<DeployIisAppPath>IISsitename</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>RemoteAgent</MSDeployPublishMethod>
<UserName>user</UserName>
<_SavePWD>True</_SavePWD>
<PublishDatabaseSettings>
<Objects xmlns="">
</Objects>
</PublishDatabaseSettings>
</PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
ERROR_USER_NOT_ADMIN诊断 - 如果您尝试连接到远程代理服务但未提供适当的管理员凭据,则会发生这种情况.解决方案 - Remote Agent Service接受内置管理员或域管理员凭据.如果您有非域设置并且想要使用其他内置管理员帐户,请执行以下操作:在远程计算机上创建单独的用户组MSDepSvcUsers.在本地和远程计算机上创建本地帐户A. 在远程计算机上添加A到MSDepSvcUsers.使用帐户A发布,这将允许您发布而无需使用内置的>管理员帐户.
此应用程序采用图像,这是背景或工作区必不可少的.我需要在给定特定坐标(顶部,左侧,宽度,高度)的情况下将输入文本字段添加到此工作空间中.这些坐标将相对于图像(上/左= 0/0).我如何相对于图像定位我的字段/元素?
<img id="background" ng-src="{{page.backgroundImage}}" />
<input type="text" ng-repeat="field in page.fields" ng-model="field.value"
ng-style="{position:'absolute',
left:field.left,
top:field.top,
width:field.width,
height:field.height}"/>
Run Code Online (Sandbox Code Playgroud)
上面的代码非常适合绝对定位,但它与图像无关.
我正在为我的应用程序创建3个缩小的包.我有两个任务要做,缩小和捆绑.Minify依赖于bundle.如果我运行minify,两个任务都会运行而没有错误.捆绑包已创建,但缩小的文件不是.如果我删除对bundle的依赖,那么我可以自己运行minify并成功创建缩小的文件.这让我相信当minify任务触发时可能正在使用文件(因为bundle还没有完成?).如何使其等待文件完全准备好?我可以通过这条小溪吗?或者将这些组合成一个任务?它们目前不是单个任务的原因是因为它们每个捆绑包输出2个文件(一个未分类和缩小的捆绑包).
var outFolder = __dirname + '\\Scripts\\dist';
var appBundles = [
{ scripts: ['Scripts/Common/**/*.js'], output: 'eStore.common.js' },
{ scripts: ['Scripts/Checkout/**/*.js'], output: 'eStore.checkout.js' },
{ scripts: ['Scripts/ProductDetail/**/*.js'], output: 'eStore.product.js' }
];
gulp.task('bundle', bundle);
gulp.task('minify', ['bundle'], minify); // this one doesn't work
gulp.task('minifyOnly', minify); // this one works
function bundle() {
appBundles.forEach(function (appBundle) {
gulp.src(appBundle.scripts)
.pipe(concat(appBundle.output))
.pipe(sourcemaps.init())
.pipe(sourcemaps.write(outFolder + '\\maps'))
.pipe(gulp.dest(outFolder))
.on('error', errorHandler);
});
}
function minify() {
appBundles.forEach(function(appBundle) {
var bundleSrc = outFolder + '\\' + appBundle.output;
gulp.src(bundleSrc)
.pipe(rename({ extname: '.min.js' …Run Code Online (Sandbox Code Playgroud) 我在一个有角度的网络应用程序中使用赛普拉斯进行e2e测试.当柏树第一次打开时,它会进入http://localhost:54401/__/#tests/integration/login.spec.ts
这显示了屏幕左侧的柏树测试基座和右侧的网络输出.一旦我的beforeEach函数调用cy.visit(),而不是更改输出,屏幕顶部的主URL将更改为:
http://localhost:4200/__/#tests/integration/login.spec.ts
然后Angular接管,它找不到__路由,所以相反页面被重定向到我的默认页面,我失去了Cypress dock/test runner.
赛普拉斯应该只是更改我的应用程序加载的框架,而不是页面URL.正在发生的事情导致赛普拉斯操纵主浏览器网址而不是帧网址.
如何解决这个问题,以便cypress定位框架而不是主浏览器窗口?这在过去有效,最近才开始起作用.我不确定它是否是柏树或铬问题.我想这可能是与柏网络安全的问题,所以我也尝试设置chromeWebSecurity: false在cypress.json无济于事.
https://docs.cypress.io/guides/guides/web-security.html#Disabling-Web-Security
我正在使用cypress 3.1.5.
我正在构建一个应用程序,让用户通过 Instagram 登录,然后读取他们的提要并将该信息用于应用程序。Instagram 有一个页面说他们的 API 将在 2020 年被弃用,但有些东西仍然有效。至于什么被弃用,什么不是,这并不简单,我还没有找到任何直接联系他们的方法。有谁知道以下 URL 是否会继续工作,如果不会,这种类型的应用程序将来是否可行?为什么 IG 和 Facebook 对 3rd 方集成变得更加封闭?
https://api.instagram.com/v1/users/self/media/recent/
尝试启动Angular2应用程序时出现以下错误:
Failed to load resource: the server responded with a status of 404 (Not Found)
angular2-polyfills.js:332 Error: Error: XHR error (404 Not Found) loading http://localhost:55707/rxjs(…)
Run Code Online (Sandbox Code Playgroud)
这是我的index.html:
<!DOCTYPE html>
<html>
<head>
<base href="/">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Streak Maker</title>
<link rel="icon" type="image/png" href="/images/favicon.png" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<!-- IE required polyfills, in this exact order -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> …Run Code Online (Sandbox Code Playgroud) 这是我的launch.json
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "Launch Server",
"request": "launch",
"program": "${workspaceRoot}/server/src/app.ts",
"cwd": "${workspaceRoot}",
"env": {
"NODE_ENV": "dev"
},
"skipFiles": [
"node_modules/**/*.js"
],
"outFiles": [
"${workspaceRoot}/dist/server/src/*.js"
],
"sourceMaps": true,
"stopOnEntry": true,
"console": "internalConsole"
},
Run Code Online (Sandbox Code Playgroud)
我的源文件夹:
我的dist文件夹:
我得到的错误是:
Cannot launch program '/Dev/myapp/server/src/app.ts'; setting the 'outFiles' attribute might help.
Run Code Online (Sandbox Code Playgroud)
如果我将"program"属性更改为""program":"$ {workspaceRoot} /dist/server/src/app.js",它可以工作,但我正在调试已转换的javascript而不是打字稿.显然是转换用.map文件工作,有什么问题?
tsconfig.json
{
"compilerOptions": {
"allowJs": false,
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es6",
"dom"
],
"mapRoot": "./",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "./dist", …Run Code Online (Sandbox Code Playgroud) angularjs ×3
angular ×2
asp.net ×1
asp.net-mvc ×1
azure ×1
css ×1
cypress ×1
debugging ×1
facebook ×1
gulp ×1
gulp-concat ×1
gulp-uglify ×1
instagram ×1
rxjs ×1
swagger ×1
swashbuckle ×1
systemjs ×1
typescript ×1
validation ×1
webdeploy ×1