TOGOUTECH

javascript - 如何减小 Angular 2、4、6、7、8、9、10 中 vendor.js 的大小?

AngularCLI创建vendor.js我不知道为什么以及它有什么用??对于新应用,此文件的大小约为3.2MB!!此文件是否包含Angular6Javascript源?您不认为这是在低速连接上加载到Internet上的大文件吗? 最佳答案 此文件包含您添加到项目中的所有库。如果您在生产模式下构建应用,文件大小会更小。ngbuild--prod 关于javascript-如何减小Angular2、4、6、7、8、9、10中vendor.js的大小?,我们在StackOverflow上找到

javascript - 在 Angular 中导航时,将 child 路由到 parent 不起作用

我使用的是angular5.1.0,路由系统有问题,让我解释一下:在我的应用程序路由模块中,我有一个url/api那个延迟加载另一个模块,在那个延迟加载的模块中我有下一个路由实现:api-routing.module.tsconstroutes:Routes=[{path:'',component:ApisComponent,data:{breadcrumbs:'APIs',},children:[{path:'',component:ApiListComponent,},{path:':id',component:Api

javascript - 显示在 Angular 2 中找不到任何记录

我一直在搜索并想知道当表在Angular2中为空时,是否有任何指令可以帮助在表中显示“未找到数据”。或者更好的是,当我订阅时,我可以在我的服务中创建该功能获取的数据?<table><tbody><tr*ngFor="letgameofGames"></td><td>{{game.name}}</td><td>{{game.type}}</td></tr></tbody></table> 最佳答案

javascript - Angular 2 使用组件属性动态设置 routerLink

我创建了一个组件,其中包含一个具有routerLink属性的元素,我想从使用该组件的模板中设置该属性。当我尝试执行此操作时,我收到错误消息“无法读取未定义的属性‘路径’”。我的组件看起来链接了这个:信息框.component.tsimport{Input,Component}from"@angular/core";import{ROUTER_DIRECTIVES}from"@angular/router";@Component({selector:"info-box",template:require("./info-box.co

javascript - 我如何将 Node.js 实现到 Ionic/Angular 应用程序中?

我目前有一个基本的“选项卡”Ionic/Angular应用程序。ionic启动测试项目选项卡我已经完成了npminstall以在项目目录中获取一些基本Node模块。对于如何同时使用Angular和Express,以及如何设置Node/服务器端,我有些困惑。我尝试查看了很多教程,发现自己有点迷失在其中,所以我希望有人能提供一些资源,帮助我朝着正确的方向前进。因为Angular和Express都执行MVC/MV*——它开始真正混淆什么做什么。我对设置以及如何让他们一起交谈感到困惑。请让我知道我可以提供哪些其他信息,因为我不确定还有什么。(该项目非常简单。)非常感谢!

javascript - 将 json 对象添加到 $cookies - Angular JS

在控制台中,我的代码正在打印:[Object,Object]我无法正常向下钻取。我尝试了JSON.Parse和JSON.stringify但没有成功。我设置凭据的服务:setCredentials.js'usestrict';//servicethathandlessettingandgettingcookiesapp.service('setCredentials',function($cookies){//functionthatgetsjsonobjectandstoresitinsideacookiethis.storeInCookie=func

javascript - Angular JS Controller 和工厂在单独的文件中

Web开发和Angular对我来说是全新的。我在同一个文件(app.js)中创建了module、factory和controller。下面是示例代码//MainModulevaripCharts=angular.module('ipCharts',[]);//FactoryipCharts.factory('securityFactory',function($http){varsecurities={};$http.get('api/Securities').success(function(data,status,headers,co

javascript - 如何将 $q 传递给 Angular Directive(指令)链接函数?

我需要使用$q我的指令的一个link函数。我需要它来包装由参数之一重新调整的可能promise(请参见下面的示例)。但是,我不知道如何将$q依赖项传递给此函数。angular.module('directives').directive('myDirective',function(){return{scope:{onEvent:'&'}//...link:function($scope,$element){$scope.handleEvent(){$q.when($scope.onEvent()){...}}}}}

javascript - AngularJS $promise then() 数据未定义

我正在尝试将数据分配给$scope变量。在我的$promise.then()函数内它显示正确但在函数外它显示为未定义。以下是我的Controller代码:angular.module('testSiteApp').controller('TestController',function($scope,Tests){$scope.test=Tests.get({id:1});$scope.test.$promise.then(function(data){$scope.tasks=data.tasks;console.log($scope.tasks);}

javascript - Angular JS在textarea中显示和编辑模型

我希望能够在<textarea>中编辑和显示复杂模型元素。这是用于从JSON响应动态生成模型字段的HTML片段:<p>parentuuid*:</p><inputng-model="parentUuid"capitalizetype="text"placeholder="String"class="form-control"style="width:200px;display:inline-block;"/><br/><p>resour