351 questions
1
vote
4
answers
2k
views
How to include .css file of my component in angular js
I have included my component's .css file in this manner
`
angular.
module('home').
component('home', {
templateUrl: 'home/home.template.html',
styleUrls: 'home/home.component.css'
...
0
votes
1
answer
57
views
Targeting keydown events to an angularJS custom directive
I am working on a problem wherein I am required to pick-up keydown events (specifically ctrl+p and then point to a print function which already exists) on a certain custom directive and under certain ...
0
votes
1
answer
131
views
How can I access AngularJs component templateUrl variable inside of a controller $init fucntion?
Good morning everybody,
After lots of search about this subject, I could find how to get things bound, but I could not find a way to get the value from the component templateUrl.
Anyone knows how to ...
1
vote
1
answer
125
views
How to pass data with Angularjs
How do i pass data from the controller to a component to show to the user?
app.js
(function(angular) {
'use strict';
angular.module('app', []).controller('MainCtrl', function MainCtrl($scope, $...
1
vote
1
answer
189
views
AngularJS - How to change components controller dynamically?
I have an angularJS component and I manually set the url for a link.
But I want to change this url after blogposts is loaded in a different method.
HTML:
<a ng-href="{{ $ctrl.readMoreUrl }}&...
1
vote
0
answers
44
views
Unable to pass data to a controller inside a component in AngularJS
I have following component
componentsModule.component('detailComponent', {
templateUrl: 'detailTemplate.html',
scope: {},
bindings: {
textParam: '='
},
controller: ['$...
0
votes
1
answer
617
views
How to set scope for AngularJS component
Suppose I build an AngularJS component
function FooController($scope, $element, $attrs, $http) {
var ctrl = this;
ctrl.bar = "WIBBLE";
}
angular.module("app").component("foo", {
templateUrl:...
0
votes
1
answer
55
views
How to load values in ng-option of a component in AngularJS
I have created a component in AngularJS to load the values in a dropdownlist. However, I am not able to pass any values to the component and, in turn, to be loaded in the list through ng-option.
The ...
0
votes
1
answer
469
views
How do you use ng-model to take in data from a parent component in AngularJS (version 1.5.5)?
Below is an image of my code's output; I know how to display data passed down from parent components (i.e., 100), but I don't know how to display the parental data via ng-model (i.e., 100 isn't ...
0
votes
0
answers
16
views
AngularJS template not updating until browser interaction [duplicate]
I'm having hard time figuring this one out so I'll try to explain it as best as I can.
I have a service like so
export class Users {
constructor(private Api) {}
public async getUsers() {
...
0
votes
1
answer
168
views
How to use component's insideHTML in the component template?
I'm trying to learn about components. I have a component like this:
app.component('modal', {
templateUrl: 'components/modal.html',
bindings: {
show: '<',
title: '@',
},
...
0
votes
1
answer
220
views
Track by used in array of objects not allowing render on children changes
So I have an array structure like so:
const array = [
{
key: 'xxx1',
data: [
{
key: 'yyy1',
//...
...
0
votes
1
answer
852
views
Vscode Extension API search all files in workspace by content matches
update
I found it: provideWorkspaceSymbols
What is the API equivalent of the search menu in vscode? The vscode.worspace.findFiles()
Signature doesn't match the input fields I have in the menu of ...
0
votes
1
answer
213
views
Route to component with route resolve | AngularJS
After going through the article https://ui-router.github.io/guide/ng1/route-to-component, we tried to use resolve in AngularJS. But unfortunately,we received the error as:
Unknown provider: ...
0
votes
1
answer
172
views
Print the div content using AngularJS
We were trying to print the content using AngularJS.We tried to bind the elements using ng-bind yet the data is not getting displayed in the document.We have attached the screenshot below and kindly ...
0
votes
1
answer
127
views
AngularJS component binding a function
Let's say, we were trying to delete an item from the list using the web api.We had created a child component named as remove-item using parameters - item and onRemove.On click of a item,we would like ...
0
votes
1
answer
70
views
Component based routing using ui-router | AngularJS
We had created a component named contact using [email protected] and [email protected] problem lies on click of a button,nothing is displayed in the home page.It would be great if someone ...
0
votes
2
answers
216
views
How do I establish communication between independent components in AngularJS
I have a Nav in which there are two pages representing two AngularJS components - Home and About. I want to pass user name from Home component to About component.
<div ng-app="myApp">
<ul&...
0
votes
3
answers
678
views
How to access nested json property
I am getting this response from an angular service:
response.data
events: Array(1)
0:
ingestionTime: 1560362454013
message: "{"server":"xxx.xxx","errorName":"HelloWorldError","error":"hello error"}"
...
0
votes
1
answer
494
views
What is the alternative of $apply in AngularJS Component
When I remove items from items list. It takes time to refresh on the browser. I am unable to found any alternate of $apply(). It's a callback function when call the component object from outside the ...
0
votes
0
answers
368
views
Why does "this" in function statement point to a wrong scope between components?
I have a component which is used several times on one page.
The first line of code in the controller stores "this" in "self" in order to always refer to the right scope.
When I call a function ...
0
votes
2
answers
99
views
AngularJS Component: How to avoid watchers for unused bindings
I have a component repeating quite a few times and would like to avoid excessive watching.
angular
.module('myModule')
.component('component', {
template: '',
bindings: {
...
0
votes
0
answers
350
views
AngularJS 1.7 - templateUrl displays url in view instead of the template
Summary
I'm trying to convert my angularjs components/directives over to TypeScript. Unfortunately, the templateUrl property doesn't display the template that's passed to it. Instead, it literally ...
0
votes
1
answer
154
views
Angularjs Custom Directive not changing DOM
Use ng-if in Angularjs Directive
I have a showTaskDetailView$ stream that I can subscribe to and I can push a boolean value through it.
angular.module('Project').directive('something', () => {
...
-1
votes
1
answer
95
views
How to operate functions of component controllers from outside
I have a component with a function inside:
app.component("myComponent", {
templateUrl: "myComponent.html",
controller: function() {
this.addApp = function (arg) {
console....
-1
votes
1
answer
48
views
Where am I doing wrong in converting angularjs component into es6 class?
The options for chart are not coming. $onChanges method is not getting invoked. There is no compilation error though. I have executed the same without es6 convention. When I have converted this into ...
5
votes
1
answer
2k
views
Two way data bindings does not trigger $onChanges in Components
Two way data bindings not updating between components
I am setting up inter component communication using two way data binding. I have one parent controller which fetches data from AJAX call and sends ...
0
votes
1
answer
75
views
angularjs html component configuration
I am implementing a simple grid component in angularjs. I prefer html configuration over javascript because that way view code and logic code is separated.
For example,
<my-grid>
<my-...
1
vote
1
answer
718
views
Component not accepting camelCase names
My issue here lie with me trying to make a navbar component, some data must be shared from the main page to the component, and while spending a few hours researching into how to use components, i can ...
0
votes
1
answer
1k
views
component within component in angularJS
I have two independent components,defined one within the other in HTML. But my second(inner) component does not populate using the template mentioned in the templateUrl property of the inner component....
0
votes
0
answers
28
views
upgrading into Components
I have just started learning to develop an angularJS app,with my final objective being updating the angular version. As an initial step I wanted to remove $scope and refactor the following code into ...
2
votes
2
answers
763
views
Scope Not Updating When Using ng-click Within a Component
I have the issue that my scope is not updating when using ng-click within a component. The scope also does not update if I use $scope.$apply or $timeout so I am not sure what the issue is.
The idea ...
6
votes
3
answers
914
views
AngularJS migration to using imports/exports
Our project is currently still running on AngularJS (v1.6) + TypeScript, but we want to start making the app ready to upgrade to the latest Angular, by implementing components, similar to how they are ...
0
votes
1
answer
104
views
Can't add an attribute to an element using $postLink - AngularJS
I have a simple component and what I'm trying to do is to add to my input element an attribute multiple dynamically but somewhy it doesn't work. Why? And is there any way to do what I want?
app....
2
votes
0
answers
653
views
How to pass object to template function of component in angularjs
I have a angularjs 1.7.x project which I used a component to add image and links in a page of website, like below:
angular.module('app', [])
.controller('MainCtrl', function MainCtrl() {
this.book = ...
0
votes
1
answer
514
views
firing $onChanges hook when collection is updated from the service in angularjs
I am trying to make $onChanges hook work by using immutable way.
Chat Service
class ChatService {
constructor() {
this.collection = {
1: [
{
chat: 'Hi',
},
...
0
votes
1
answer
23
views
Plug angularjs directive into component
I currently have a generic list component and I want to add, depending on where I use it, different callbacks for adding/removing/updating items to that list.
My current implementation looks like ...
1
vote
1
answer
436
views
Angularjs 1.5 component modal with callback function that is called multiple times by embedded Object in IE11 not updating Angular binding
In IE 11, I have an Angularjs 1.5 modal component as below. The modal opens and on render event it calls a function outside of the angular app with a callback function contained in this component. ...
0
votes
0
answers
32
views
AngularJS when use shared directive to isolate directive?
Sometimes I need to pass multiple complex objects to directives.
My question is which way of work is better, as your opinion, or maybe as a standard, if there is.
Doing so:
<my-directive
config=...
-1
votes
1
answer
886
views
ng-repeat pass to the component
Hi i am very new to angularjs web development with typescript and really stuck with a problem. I dont think it should be a hard problem yet i have spent two days on it.
I am trying to figure out how ...
0
votes
1
answer
641
views
AngularJS use component as Input tag placeholder
I have a localization component that looks like this:
(function() {
'use strict';
angular
.module('app.core')
.component('i18n', {
templateUrl: './i18n.html',
bindings: {
...
0
votes
1
answer
884
views
How to use ui-sref in ui-router AngularJS
i have file index.html:
<!DOCTYPE html>
<html>
<head>
<style>
.navbar { border-radius:0; }
</style>
<link rel="stylesheet" type="text/css" href="...
0
votes
1
answer
357
views
How to share AngularJS controller with several components having custom behavior
In AngularJS >1.5, how can several related components share a common controller with common functionallity while being able to have custom behavior for every distinct component?
For example ...
1
vote
1
answer
308
views
AngularJS 1.6.9 controller variable bound to service variable doesn't change
I have 2 components which are both accessing a service. One component delivers an object and the other one is supposed to display it or just receive it. The problem is that after the initialization ...
1
vote
1
answer
47
views
have trouble understanding angularjs components. Only used directives before
So I've been using one controller one view, and using only Directives for parts that I want to use repeatedly.
Now Im going for an interview and I am asked to learn about component, which I never ...
0
votes
1
answer
72
views
Angularjs - how to access to one controller from other module angularjs (use typescript)
// in engagement.component.ts:
class EngagementMembersController {
alphabetic: Array<string> = 'abcdefghijklmnopqrstuvwxyz'.split('');
constructor() {}
export const ...
1
vote
1
answer
139
views
how to share data between 2 component angularjs (use typescrip)
i have a component :
export const TopBarMemberComponent: angular.IComponentOptions = {
bindings: {},
require: {
controller: '^EngagementSetupMember'
},
...
0
votes
0
answers
93
views
How to close all modals from different Angularjs components
On my project, we use Angularjs 1.7 and bootstrap modals and we have a lot of components. Some components has modal. So my question is: how to close these modals when I am on different component.
Say ...
0
votes
1
answer
397
views
How to save w3schools example as an AngularJs component?
I am creating a simple app in AngularJS and I am trying to build form steps wizard but JS is not getting applied.
I have copy pasted all the code from w3schools editor to the component.html file
...
0
votes
0
answers
33
views
Changing controller values doesn't reflect on the components in other directive
I've been using a directive for the code below, with one controller containing all the DOM manipulating logic for it, I've been asked to convert it into a component and since the change, the changes ...