angular-directive

AngularJS: Using $compile on html that contains directives with templateurl

佐手、 提交于 2019-11-30 09:53:15
I have a legacy application that has some content inserted into the DOM via jQuery. I would like the legacy parts of the codebase to be responsible for compiling the html that it inserts into the DOM. I can get it to compile the initial html using $compile , but any DOM elements added by a directive's template or templateUrl are not compiled, unless I call $scope.$apply() from within the directive itself. What am I doing wrong here? Link to fiddle: http://jsfiddle.net/f3dkp291/15/ index.html <div ng-app="app"> <debug source='html'></debug> <div id="target"></div> </div> application.js angular

Use GeoCharts in Angularjs

北城余情 提交于 2019-11-30 07:35:51
How can I use Google GeoChart in Angular? I want to inject angular data inside geoChart like this examples in Javascript https://developers.google.com/chart/interactive/docs/gallery/geochart?hl=it#Regions function drawRegionsMap() { var data = google.visualization.arrayToDataTable([ ['Country', 'Popularity'], ['Germany', 200], ['United States', 300], ['Brazil', 400], ['Canada', 500], ['France', 600], ['RU', 700] ]); var options = {}; var chart = new google.visualization.GeoChart(document.getElementById('regions_div')); chart.draw(data, options); } Some advice? Silvio Troia Angular Google Chart

What is the calling order of angularjs functions (config/run/controller)? [duplicate]

我的梦境 提交于 2019-11-30 07:35:02
This question already has an answer here: AngularJS app.run() documentation? 2 answers There are controllers constants directives services factory run config filters functions of angular.js . What is the calling order of all these modules? Learning this I made a fiddle observing the behaviour by console.log . Its like app config app run directive setup directive compile (app controller dependencies) service factory inner factory inner service app controller filter directive linking filter render (w.r.t the markup) Observe yourself here (Check Console). EDIT New Fiddle with filters added 来源:

ng-repeat sorting arrow not working in javascript datatables

女生的网名这么多〃 提交于 2019-11-30 07:01:01
问题 I'm very new to AngularJs and datatables. I have a requirement to populate the data in table rows using ng-repeat. Iam able to populate the rows and enabling the sorting for the first time. When i click on the arrows to sort ascend or descend the row data wiping off. Here is my table data <table datatable="ng" id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th class="col1">Campaign Name</th> <th class="col4">Description</th> <th class="col5">Activate/Deactivate</th>

Is it possible to crate a Validator for a custom component (not for a FormControl)

我怕爱的太早我们不能终老 提交于 2019-11-29 17:34:37
I am trying to do smth like this @Directive({ selector: '[myVal][myCustomInputToComponent]', providers: [ { provide: NG_VALIDATORS, useExisting: forwardRef(() => MyVal), multi: true } ] }) export class MyVal implements OnInit, Validator { @Input() input: any; constructor(private el: ElementRef) { } ngOnInit(): void { console.log('validator input', this.input); } validate(): { [key: string]: any } { console.log('validate', this.input) return { validatorName: { valid: false } }; } } And validate method obviously was not called. But maybe there is some way how you detect components with valid and

How to pass values to directive in angular

匆匆过客 提交于 2019-11-29 16:37:49
问题 My code, <modal *ngIf='showModal' [imageValue]="imageId"></modal> My model component, @Component({ selector: 'modal', templateUrl: './app/modal/modal.component.html', providers: [HeaderClass] }) export class ModalComponent { imageValue:any; I want to get the value of this 'imageValue' but I dont know how to do it.Can anyone please help me.Thanks. 回答1: If you want to send data to directive then you should try like this: This is my custom directive, and I am going to share two value from

Angular gives @angular/core 404 not found error when using directives

梦想的初衷 提交于 2019-11-29 10:43:34
When I add in this line of code into my @Component : directives: [HeroDetailComponent] The code breaks, and gives me this error: GET http://localhost:3000/@angular/core 404 (Not Found) These are the scripts in my index.html : <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

Use GeoCharts in Angularjs

百般思念 提交于 2019-11-29 09:55:55
问题 How can I use Google GeoChart in Angular? I want to inject angular data inside geoChart like this examples in Javascript https://developers.google.com/chart/interactive/docs/gallery/geochart?hl=it#Regions function drawRegionsMap() { var data = google.visualization.arrayToDataTable([ ['Country', 'Popularity'], ['Germany', 200], ['United States', 300], ['Brazil', 400], ['Canada', 500], ['France', 600], ['RU', 700] ]); var options = {}; var chart = new google.visualization.GeoChart(document

AngularJS: Using $compile on html that contains directives with templateurl

我与影子孤独终老i 提交于 2019-11-29 09:43:45
问题 I have a legacy application that has some content inserted into the DOM via jQuery. I would like the legacy parts of the codebase to be responsible for compiling the html that it inserts into the DOM. I can get it to compile the initial html using $compile , but any DOM elements added by a directive's template or templateUrl are not compiled, unless I call $scope.$apply() from within the directive itself. What am I doing wrong here? Link to fiddle: http://jsfiddle.net/f3dkp291/15/ index.html

How is Angular's *ngFor loop implemented?

徘徊边缘 提交于 2019-11-29 08:30:20
I wonder how does Angular's *ngFor directive actually work under the hood? I would like to know the whole process that happens when I use the directive. For downvoters : I've seen the ng-for-of file, although there is no single usage of passed to *ngFor array's e.g. join() method that I know is invoked. Thanks for your support :) Here is the plunker that shows the behavior: https://plnkr.co/edit/IXVxWrSOhLBgvSal6PWL?p=preview Here is a high level overview. Suppose you define your template like this: <span *ngFor="let item of items">{{item}}</span> Then it's transformed to the following by the