【Angular.JS利用ng-disabled属性和ng-model实现禁用button效果】教程文章相关的互联网学习教程文章

Javascript-Ionic 3和Angular 4-未捕获(承诺):TypeError:无法读取未定义的属性“ title”【代码】

我真的对Angular和Ionic都很陌生.我正在遵循我在网上找到的教程,以构建一个用于培训和测试目的的小型应用程序.但是,在教程中使用了Angular 2.我正在使用Angular 4和Ionic 3.请,有人知道为什么会收到下面的错误吗?我还按照另一个教程进行操作,但出现了相同类型的错误.有人请帮助我.Runtime Error Uncaught (in promise): TypeError: Cannot read property 'title' of undefined TypeError: Cannot read property 'title' of undef...

javascript-无法读取未定义的属性’propostas_realizadas’-Angular 2【代码】

我在Angular 2中有一个应用程序,在其中尝试在控制台上打印一些数据“ console.log(this.disputa.propostas_realizadas)”,但是当我尝试打印它时,却收到此消息:Cannot read property ‘propostas_realizadas’ of undefined有趣的是(或不太有趣的)事情是我仅在ngOnInit()中得到此消息,如果我将代码移至其他函数,它将很好地工作,但我真的需要在ngOnInit()中使用此消息.import { Component, OnInit, OnChanges } from '@angular/core...

javascript-AngularJS-选择标记-选择时从选项获取属性【代码】

因此,我有一个选择标签,其中显示了一些选项,我希望当选择一个选项时,它将带有数据内容属性并将其值(属性的值)粘贴到我拥有的输入元素中.它仅是说明性的,值属性应以表格形式发送.<input ng-model="refreshedByExample" type="text"> <select ng-model="example"><option value="1" data-something="valueForRefreshedByExample1">1</option><option value="2" data-something="valueForRefreshedByExample2">2</option><option valu...

Javascript-http / rxjs中的Angular 2重定向捕获回调导致TypeError:无法读取未定义的属性’subscribe’【代码】

从rxjs catch函数重定向时,出现错误:EXCEPTION:TypeError:无法读取未定义的属性“ subscribe” 这是contactService的相关部分:getContacts () {...return this.http.get(this.apiUrl, options).map(this.extractData, this).catch(err => {this.handleError(err)}) } ... handleError (error) {if(error.status === 401){//the redirect works great, except, when added, I get the exception errorthis.router.navigate(['/l...

javascript-Angular 2-如何将id属性设置为动态加载的组件【代码】

我正在使用DynamicComponentLoader加载子组件,它会产生以下html:<child-component> Child content here </child-component>这是我在父级中加载组件的方式ngAfterViewInit(){this._loader.loadIntoLocation(ChildComponent,this._elementRef,'child');}如何将id属性添加到子组件,以便产生以下html:<child-component id="someId" > Child content here </child-component>解决方法:如果可能的话,我会向ChildComponent添加一个字段并...

javascript – angularjs从属性文件中读取【代码】

在angularJS中,如何从属性文件中读取值?connection.properties: url="http://localhost:8080" user= "me" get= "GET" post= "POST"app.js:var app = angular.module('testing',[]); app.controller('testCtrl',function($scope,$http) { $http({ url: connection.properties.url ,method: connection.properties.get, params: {user: connection.properties.user}) }); });解决方法:如果connection.prop...

javascript – 如何在Angular中使用ngFor循环对象属性【代码】

这篇文章是关于我在工作中发现的一个有趣问题. 如果你还不知道.我在谈论Angular 2 问题 因此,您希望显示列表的标记,此列表的值来自后端,并且由于某种原因而不是您收到类似的旧对象数组.{ "car" : { "color" : "red","model" : "2013"},"motorcycle": { "color" : "red","model" : "2016"},"bicycle": { "color" : "red","model" : "2011"} }然后尝试使用* ngFor但会出现一条错误消息:Cannot find a differ supporting object '[ob...

javascript – AngularJS – 有条件地使用属性指令【代码】

我使用“draggable”指令来支持图像拖动.但是,根据用户的角色,我需要禁用某些用户组的图像拖动.我使用了以下代码.<!--draggable attribute is used as handle to make it draggable using jquery event--> <li ng-repeat="template in templates" draggable id="{{template._id}}" type="template" class="template-box"> <!-- Images and other fields are child of "li" tag which can be dragged.--> ...

javascript – Angular 5:ng build – -prod由于clean-css而失败:无法读取未定义的属性“line”【代码】

我的应用程序属于Angular 5.2.6 ng服务的事情是正常的 但是在运行时:ng build –prod,在失败之前需要一段时间 这些错误似乎与clean-css操作有关: 错误跟踪:92% chunk asset optimization/home/khalidvm/Desktop/Workspace/Front/frontend_v2/node_modules/clean-css/lib/reader/input-source-map-tracker.js:37if (originalPosition.line === null && line > 1 && selectorFallbacks > 0) {^TypeError: Cannot read property 'l...

javascript – angularjs中`value`属性和`ng-value`属性之间的区别是什么【代码】

angularjs模板中值和ng值属性之间有什么区别?如果我在使用value属性的字段上使用ng-if,它可以正常工作,但如果我将属性值更改为ng-value,它将停止工作.example 1 // it works <input type='radio' ng-model='difficulty' value='hard'/> <div ng-if="difficulty == 'hard'"><p>difficulty is hard</p> </div> Example 2 // it doesn't work<input type='radio' ng-model='level' ng-value='hard'/> <div ng-if= "level == 'hard'...

javascript – AngularJS如何使用自定义HTML5元素标签和属性?【代码】

大多数浏览器似乎允许您创建您喜欢的任何元素标记,并将您喜欢的任何属性名称添加到元素中.例如:<!DOCTYPE html> <html> <body> <div my-attribute="has no data- prefix, but seems to behave like an attribute should"><br/><hello-world style="display:block;background:#eee">Hello Everybody</hello-world><goodby-world style="background:#faa">Default display is inline</goodbye-world> </div> </body> </html>以上显示...

javascript – Angular通过其属性过滤对象【代码】

我有一个具有一系列对象属性的对象,它们具有以下类似结构(这是数据从服务返回的方式):{"1": {"type": "foo","name": "blah"},"2": {"type": "bar"},"3": {"type": "foo"},"4": {"type": "baz"},"5": {"type": "test"} }当我进行ng-repeat时,我可以遍历所有这5个对象,例如:<div ng-repeat="item in items">{{item.type}}</div>但是,我真正想要做的只是迭代那些不是“foo”类型的项目,即3次迭代而不是5次.我知道过滤器可以某种方式...

javascript – 如何使用angularjs(1.x)动态设置HTML元素的id属性?【代码】

提供了一个div类型的HTML元素,如何设置其id属性的值,这是范围变量和字符串的串联?解决方法:正如官方文档中所介绍的那样,ngAttr指令在这里可以完全有所帮助 https://docs.angularjs.org/guide/interpolation#-ngattr-for-binding-to-arbitrary-attributes 例如,要设置div元素的id属性值,以便它包含索引,视图片段可能包含<div ng-attr-id="{{ 'object-' + myScopeObject.index }}"></div>将被内插到<div id="object-1"></div>

javascript – 为什么在AngularJS指令中不推荐使用`replace`属性?

根据the API docs,指令’replace属性已被弃用,因此将来所有指令都将使用当前默认值replace:false. 这消除了开发人员替换元素指令元素的能力,但没有明显替代此功能. 有关元素指令如何使用和不使用replace的示例,请参见this plunk:true. 为什么这个有用的属性被弃用而没有替换?解决方法:UPDATE 其中一位合作者表示不会被删除,但已知错误将无法修复.https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f...

javascript – Angular – {{}}不在ng-model属性标记中解析【代码】

我想在我的网站上动态添加一些复选框,并根据它们的值进行过滤. 我在通过ng-model将每个过滤器添加到过滤器对象的部分失败了.<div ng-repeat="filter in menu.filters"><label>{{filter.title}}</label><input type="checkbox" ng-model="filters.filter{{$index+1}}" ng-true-value="{{filter.stub}}" ng-false-value='' /> </div>但是,{{$index 1}}或实际上在ng-model属性中使用{{}}会破坏整个循环. 我错过了什么? 这是页面的完整...