Getting reference error of jQuery after adding jQuery DateTimePicker (not official) in angular project
up vote
1
down vote
favorite
In my angular project, when I didn't add jQuery DateTimePicker Clean jQuery DateTimePicker
jQuery was working fine with my angular project. Here's how I have defined it in my project.
lib.ts
declare var jQuery: any;
window['jQuery'] = require('jquery');
window['$'] = window['jQuery'];
and using it in any component like this
account.component.ts
import { Component, AfterViewInit } from '@angular/core'
declare var $ : any;
@Component({
selector: 'app-account',
templateUrl: './account.component.html',
styleUrls: ['./account.component.css']
})
export class AccountComponent implements AfterViewInit {
constructor(){
}
ngAfterViewInit(){
$(".submitBtn").click(() => {
$(this).css("color", "red");
});
}
}
And I am not getting any error on the console. But when did I add jQuery DateTimePicker ( link on the above ) into my project.
package.json
"dependencies": {
// Other Dependencies //
"jquery-datetimepicker": "^2.5.20",
// Other Dependencies //
}
defined it into scripts as part of angular-cli.json
"styles": [
"styles.css",
"../node_modules/jquery-datetimepicker/build/jquery.datetimepicker.min.css"
],
"scripts": [
"../node_modules/jquery-datetimepicker/build/jquery.datetimepicker.full.js",
],
It started giving me error on the console.
Uncaught ReferenceError: jQuery is not defined
at scripts.bundle.js:2661
at scripts.bundle.js:2663
In my template, jQuery DateTimePicker is working absolutely fine when we do
$('#demo').datetimepicker({inline:true,});
But that Reference error is still there on my console , it appears whenever I hit refresh or change any thing inside IDE.
jquery angular
add a comment |
up vote
1
down vote
favorite
In my angular project, when I didn't add jQuery DateTimePicker Clean jQuery DateTimePicker
jQuery was working fine with my angular project. Here's how I have defined it in my project.
lib.ts
declare var jQuery: any;
window['jQuery'] = require('jquery');
window['$'] = window['jQuery'];
and using it in any component like this
account.component.ts
import { Component, AfterViewInit } from '@angular/core'
declare var $ : any;
@Component({
selector: 'app-account',
templateUrl: './account.component.html',
styleUrls: ['./account.component.css']
})
export class AccountComponent implements AfterViewInit {
constructor(){
}
ngAfterViewInit(){
$(".submitBtn").click(() => {
$(this).css("color", "red");
});
}
}
And I am not getting any error on the console. But when did I add jQuery DateTimePicker ( link on the above ) into my project.
package.json
"dependencies": {
// Other Dependencies //
"jquery-datetimepicker": "^2.5.20",
// Other Dependencies //
}
defined it into scripts as part of angular-cli.json
"styles": [
"styles.css",
"../node_modules/jquery-datetimepicker/build/jquery.datetimepicker.min.css"
],
"scripts": [
"../node_modules/jquery-datetimepicker/build/jquery.datetimepicker.full.js",
],
It started giving me error on the console.
Uncaught ReferenceError: jQuery is not defined
at scripts.bundle.js:2661
at scripts.bundle.js:2663
In my template, jQuery DateTimePicker is working absolutely fine when we do
$('#demo').datetimepicker({inline:true,});
But that Reference error is still there on my console , it appears whenever I hit refresh or change any thing inside IDE.
jquery angular
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
In my angular project, when I didn't add jQuery DateTimePicker Clean jQuery DateTimePicker
jQuery was working fine with my angular project. Here's how I have defined it in my project.
lib.ts
declare var jQuery: any;
window['jQuery'] = require('jquery');
window['$'] = window['jQuery'];
and using it in any component like this
account.component.ts
import { Component, AfterViewInit } from '@angular/core'
declare var $ : any;
@Component({
selector: 'app-account',
templateUrl: './account.component.html',
styleUrls: ['./account.component.css']
})
export class AccountComponent implements AfterViewInit {
constructor(){
}
ngAfterViewInit(){
$(".submitBtn").click(() => {
$(this).css("color", "red");
});
}
}
And I am not getting any error on the console. But when did I add jQuery DateTimePicker ( link on the above ) into my project.
package.json
"dependencies": {
// Other Dependencies //
"jquery-datetimepicker": "^2.5.20",
// Other Dependencies //
}
defined it into scripts as part of angular-cli.json
"styles": [
"styles.css",
"../node_modules/jquery-datetimepicker/build/jquery.datetimepicker.min.css"
],
"scripts": [
"../node_modules/jquery-datetimepicker/build/jquery.datetimepicker.full.js",
],
It started giving me error on the console.
Uncaught ReferenceError: jQuery is not defined
at scripts.bundle.js:2661
at scripts.bundle.js:2663
In my template, jQuery DateTimePicker is working absolutely fine when we do
$('#demo').datetimepicker({inline:true,});
But that Reference error is still there on my console , it appears whenever I hit refresh or change any thing inside IDE.
jquery angular
In my angular project, when I didn't add jQuery DateTimePicker Clean jQuery DateTimePicker
jQuery was working fine with my angular project. Here's how I have defined it in my project.
lib.ts
declare var jQuery: any;
window['jQuery'] = require('jquery');
window['$'] = window['jQuery'];
and using it in any component like this
account.component.ts
import { Component, AfterViewInit } from '@angular/core'
declare var $ : any;
@Component({
selector: 'app-account',
templateUrl: './account.component.html',
styleUrls: ['./account.component.css']
})
export class AccountComponent implements AfterViewInit {
constructor(){
}
ngAfterViewInit(){
$(".submitBtn").click(() => {
$(this).css("color", "red");
});
}
}
And I am not getting any error on the console. But when did I add jQuery DateTimePicker ( link on the above ) into my project.
package.json
"dependencies": {
// Other Dependencies //
"jquery-datetimepicker": "^2.5.20",
// Other Dependencies //
}
defined it into scripts as part of angular-cli.json
"styles": [
"styles.css",
"../node_modules/jquery-datetimepicker/build/jquery.datetimepicker.min.css"
],
"scripts": [
"../node_modules/jquery-datetimepicker/build/jquery.datetimepicker.full.js",
],
It started giving me error on the console.
Uncaught ReferenceError: jQuery is not defined
at scripts.bundle.js:2661
at scripts.bundle.js:2663
In my template, jQuery DateTimePicker is working absolutely fine when we do
$('#demo').datetimepicker({inline:true,});
But that Reference error is still there on my console , it appears whenever I hit refresh or change any thing inside IDE.
jquery angular
jquery angular
asked Nov 19 at 7:09
Rishikesh Dehariya
455
455
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
This will help you :
1)Install Jquery Plugin For angular
npm install jquery --save
2)Now in your app.module.ts add
import * as $ from "jquery"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
This will help you :
1)Install Jquery Plugin For angular
npm install jquery --save
2)Now in your app.module.ts add
import * as $ from "jquery"
add a comment |
up vote
2
down vote
This will help you :
1)Install Jquery Plugin For angular
npm install jquery --save
2)Now in your app.module.ts add
import * as $ from "jquery"
add a comment |
up vote
2
down vote
up vote
2
down vote
This will help you :
1)Install Jquery Plugin For angular
npm install jquery --save
2)Now in your app.module.ts add
import * as $ from "jquery"
This will help you :
1)Install Jquery Plugin For angular
npm install jquery --save
2)Now in your app.module.ts add
import * as $ from "jquery"
answered Nov 19 at 7:17
sonal.paghdal
1295
1295
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53369840%2fgetting-reference-error-of-jquery-after-adding-jquery-datetimepicker-not-offici%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown