小编Mik*_*ird的帖子

在文档就绪时触发jQuery更改函数

我的更改功能允许用户从一个国家切换到另一个国家,并获得不同的文本和功能.它在更改国家/地区选择时有效.但是在初始页面加载时,它不会触发jQuery更改来设置隐藏和显示默认/初始国家/地区的文本div.

两个div都显示在初始页面加载时.当我改变然后回到默认/初始国家时,更改火灾,隐藏和显示火灾,并显示正确的信息和功能.

我已尝试document.ready在开关选择内部和更改功能外部使用更改功能.两者都没有工作 - 他们不会在doc准备好的交换机案例中激活hide,show和其他jQuery.我不清楚'ready'是否是一个有效的触发事件.

我也尝试过:

$('input[name=country]').value('US').trigger('click'); 
Run Code Online (Sandbox Code Playgroud)

但它打破了改变功能.这是代码.下面的国家选择只是2个国家,以保持简单,但实际上,有很多.

$(document).ready(function()
{
//1st tier - select country via radio buttons:           
//Initialize country
$('input[name=country]:first').attr('checked', true);   //Set first radio button (United States)
//$('input[name=country]:first').attr('checked', true).trigger('ready');  //sets 1st button, but does not fire change
//$('input[name=country]:first').trigger('click'); //sets 1st button, but does not fire change

$('input[name=country]').change(function ()
{                                                                               
// change user instructions to be country specific
    switch ($('input[name=country]:checked').val())
    {
        case 'US':
        $('#stateMessage1').text('2. Select a state or territory of the United States.');
        $('#stateMessage2').text('Start typing a state of …
Run Code Online (Sandbox Code Playgroud)

jquery initialization onchange

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

Angular2 Material Design alpha.9-3对@ angular/material有'404 not found'

我按照角材料2的使用说明安装了@ angular/material.通过Atom,我更新了package.json,app.module,除了Getting Started说明之外,我更新了systemjs.config,如下所示:'@ angular/material':'node_modules/@ angular/material',

我收到这些错误:zone.js:1274 GET http:// localhost:3000/node_modules/@ angular/material / 404(Not Found)

(SystemJS)XHR错误(404 Not Found)loading http:// localhost:3000/node_modules/@ angular/material(...)

我相信我已经跟踪了这个问题,即许多@angular文件夹都有一个包含umd文件的bundle子文件夹,但@ angular/material文件夹没有bundle子文件夹.因此,'解包'功能找不到@ angular/material/material.umd.js

systemjs在我的舒适区之外,所以我不确定上述内容,但我无法用alpha.9-3的新文件结构解决404问题.这是相关代码(其他组件未显示).

的package.json

 "@angular/material": "2.0.0-alpha.9-3",
Run Code Online (Sandbox Code Playgroud)

app.module

 import { MaterialModule } from '@angular/material';
 @NgModule({
  imports: MaterialModule.forRoot(),
Run Code Online (Sandbox Code Playgroud)

systemjs.config

  (function(global) {
    var map = {
      'app': 'app',
      // angular bundles
      '@angular':                   'node_modules/@angular',
      // other libraries
      'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
      'rxjs':                       'node_modules/rxjs',
      '@angular/material': 'node_modules/@angular/material',
    };
    var packages = {
      'app': { main: 'main.js',  defaultExtension: 'js' },
      'rxjs':{ defaultExtension: 'js' },
      'angular2-in-memory-web-api': { main: 'index.js', …
Run Code Online (Sandbox Code Playgroud)

javascript systemjs angular-material2 angular

6
推荐指数
1
解决办法
4946
查看次数

我的 Windows 10 升级后 Apache 无法启动

我从 Windows 7 升级到了 Windows 10。在 Bitnami 堆栈中,MySQL 正在运行,但我无法在 Windows 启动时将 Apache 作为服务启动。我曾尝试使用管理器工具。我尝试了很多事情,包括:将侦听端口和服务器名称更改为 8888,然后更改为 8118,关闭 Windows Defender,查看 Apache 的日志目录和错误目录中的文件(并没有发现任何条目),按下启动 Bitnami Webstack 按钮(刚刚得到一个空标签)。每次更改后我都重新启动了 Windows 10。

管理器工具中的应用程序日志显示:正在启动 Apache Web 服务器...退出代码:1 标准输出:

Stderr:无法启动apache

如何让 Apache 在 Windows10 中启动?Windows 10 中是否有一些设置对于允许 Apache 运行至关重要?

windows apache

4
推荐指数
1
解决办法
5180
查看次数

使用TypeScript的Angular2路由具有编译错误并获得意外的令牌控制台错误

我正在使用TypeScript 6.0.0试验Angular2 alpha35.我的index.html加载了一个headerFooter组件.然后我添加了router-outlet标签,在其间插入几个页面.在如何通过angular2中的打字稿更改路由器的代码有助于消除几个错误,但经过几个小时的颠簸,我仍然在@RouteConfig中得到一个TypeScript错误,即','预期.在 ...(在组件之后),以及它找到的部分页面组件中的意外@令牌的控制台错误(GET home.js没问题),但无法加载/插入.这是相关的代码.app.ts,index.html和home.js都在同一目录中.

的index.html

<residence-app><h1>Loading . . .</h1></residence-app>
Run Code Online (Sandbox Code Playgroud)

app.ts

/// <reference path="../angular2-oPost/typings/angular2/angular2.d.ts" />
"use strict";
import { Component, View, bootstrap, Directive } from "angular2/angular2";
import { routerInjectables, routerDirectives, Router, RouterOutlet, RouteConfig, RouterLink } from 'angular2/router';
import { Home } from "home";
@Component({
  selector: 'residence-app'
})
@View({
  directives: [ RouterOutlet, RouterLink, Home ],
  templateUrl: "components/navigation/headerFooter.html",
  styleUrls: ['commonStyles/headerFooter.css']
})
@RouteConfig( [  {path: '/home', as:  component: Home } ] )
// TypeScript error  ',' expected.  at line …
Run Code Online (Sandbox Code Playgroud)

typescript angular

4
推荐指数
1
解决办法
8332
查看次数

图像不会显示在AWS S3托管的静态页面上

在S3中,我有一个index.html,一个CSS文件和一个包含3个jpg文件的images文件夹。我将jpg剪切并粘贴到S3文件夹中。他们显示在那里。我按照说明设置了显示策略,以显示给所有人。显示页面,但图像不显示。我得到了替代文本和工具提示,但没有图像。在页面上,当我右键单击“新建选项卡中的打开图像”时,我收到XML拒绝访问的消息。该页面是:http : //s3.amazonaws.com/pittsfordcommunitycenter/index.html

图像显示在我的开发PC上。我已经在AWS中尝试了很多东西,包括文档建议的东西。我需要更改什么?

image amazon-s3 amazon-web-services

4
推荐指数
1
解决办法
4577
查看次数

角度2错误:无法解析FormGroup的所有参数

我正在遵循Thoughtram的FormBuilder教程 http://blog.thoughtram.io/angular/2016/06/22/model-driven-forms-in-angular-2.html。 我复制了代码并更改了一些变量名。我正在使用Angular 2.1.2,Typescript 2.0.8和Angular Material2(来自Google)。Atom Typescript在任何页面上都没有错误。但是,加载时出现错误,并且此新代码也无法加载页面。

zone.js:388 Unhandled Promise rejection: Can't resolve all parameters for FormGroup: (?, ?, ?). ; Zone: <root> ; Task: Promise.then ; Value: Error: Can't resolve all parameters for FormGroup: (?, ?, ?).(…) Error: Can't resolve all parameters for FormGroup: (?, ?, ?).
at CompileMetadataResolver.getDependenciesMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14598:21)
at CompileMetadataResolver.getTypeMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14499:28)
at eval (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14642:43)
at Array.forEach (native)
at CompileMetadataResolver.getProvidersMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14622:21)
at CompileMetadataResolver.getDirectiveMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14262:36)
at eval (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14367:51)
at Array.forEach (native)
at CompileMetadataResolver.getNgModuleMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14361:51)
at RuntimeCompiler._compileComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17063:49)consoleError @ zone.js:388_loop_1 …
Run Code Online (Sandbox Code Playgroud)

javascript forms angular

4
推荐指数
1
解决办法
8774
查看次数

在跟踪Angular2 Quickstart for beta.0时无法加载boot.js.

我已升级到Angular2@2.0.0-beta.0.app.ts和boot.ts都在我的src目录中(与Quickstart中的app相比).src和index.html位于项目目录中 - angular2-oPost,与Quickstart示例类似.我已经尝试了很多东西但总是得到 - 找不到boot.js,错误加载boot.js我的index.html加载脚本全部加载并且是:

<base href="/src"/>
<!--1. Load library links for ES6-related imports, then load angular2 modules -->
<script src="./angular2-oPost/node_modules/systemjs/dist/system.src.js"></script>
<script src="./angular2-oPost/node_modules/angular2/bundles/angular2-polyfills.min.js"></script>
<script src="./angular2-oPost/node_modules/rxjs/bundles/Rx.js"></script> 
<script src="./angular2-oPost/node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="./angular2-oPost/node_modules/angular2/bundles/router.min.js"></script>
<!-- 2. Configure SystemJS -->
<script>System.config({
  packages: {
    src: {
      format: 'register',
      defaultExtension: 'js'
      }
    }
  });
  System.import('src/boot').then(null, console.error.bind(console));
</script>
Run Code Online (Sandbox Code Playgroud)

boot.ts来自Quickstart,简单地说:

"use strict";
import { bootstrap }    from 'angular2/platform/browser';
import { ResidenceApp } from './app';
bootstrap( ResidenceApp );
Run Code Online (Sandbox Code Playgroud)

app.ts有一些导入语句,@ Component,@ View,@ RouteConfig和一个bootstrap语句.没有加载.Console错误声明是:

GET http://localhost/src/boot.js [HTTP/1.1 404 Not Found 31ms]
15:53:05.058 Error: …
Run Code Online (Sandbox Code Playgroud)

javascript systemjs angular

2
推荐指数
1
解决办法
6462
查看次数