Say that an app needs to be created using AngularJS with Cordova in Visual Studio, do I require anything else besides the Google CDN to use AngularJS?
<!doctype html>
<html ng-app>
<head>
<title>My Angular App</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
</head>
<body>
</body>
</html>
I notice that npm is usually used to install AngularJS, though if just a simple app needs to be created, could this be sufficient.
Code from: https://docs.angularjs.org/misc/downloading
That's all you need. I find installing angular locally is great for development, since I use developer tools to disable caching and I don't want to ping the CDN everytime I update a view, but for quick projects the CDN is fine.
Related
I have a react website and in my html template I put the google analytics tracking code snippet.
The tracking works on my local (so I can actually see my dev session in GA console) but it doesn't work after I deploy to cloud. Here how my template looks like and react just render the root div.
<!DOCTYPE html>
<html lang="en">
<head>
...
</head>
<body>
<div id="root" />
</body>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="GA link..."></script>
<script>
GA tracking code...
</script>
</html>
My site is here. You can see from the source code the tracking code is there. However current session just doesn't show up in GA.
When I go to your site I see calls going out to Google Tag Manager and Google Analytics and Doubleclick.
Maybe you have a script blocker (uBlock Origin, Noscript, ...) disabled on localhost but active on the production site?
I resolved it eventually. Regenerate another project in GA and use the new project worked for me. Maybe it was something mess up with my old project setup.
I've generated a Spring Boot application by using Spring Initializr. This is the screenshot of my resources directory.
I added Angular dependencies by using <script> tag in index.html
<!DOCTYPE html>
<html lang="en" ng-app="companyApp">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-route.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-resource.min.js"></script>
<script src="app.js"></script>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
Hello, Spring!
</body>
</html>
My main application class is configured with #SpringBootApplication annotation.
Once I open the page, I get this error in the console
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.0/$injector/modulerr?p0=companyApp&p1=Error…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.5.0%2Fangular.min.js%3A20%3A449)
From documentation I see that some module failed to load.
Should I include any other libraries in the index.html page to fix this error?
Solved the issue. Just use Bower to download needed dependencies and add them to /static directory.
Include in index.html
<!DOCTYPE html>
<html lang="en">
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-resource/angular-resource.min.js"></script>
<script src="bower_components/angular-route/angular-route.min.js"></script>
<script src="app/app.js"></script>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body ng-app="companyApp">
Hello, Spring!
</body>
</html>
if you want to split your static contents in many ways:
put them separately on apache/nginx server then it will access your spring boot application throw REST, but with different IP "if different machine" or Port "on same machine".
spring boot application can get static content outside its fat jar if you put the in /static folder in same path of your fat jar file, and you can change this path in application.properties using spring.resources.staticLocations property check here
finally you can make jar project to contains your static contents and add this project using maven as dependency to your spring boot project, do not forget your static contents have to be in /resources/static
which option to use based on you case and you project size but it is recommended to split it if you have different developers working on front/back end.
Just add AngularJS using Spring Initializr and it will do it all for you, or do it separately and copy how it generates the front-end layout. I personally have resources -> static -> app then have all of my partials within 'app', index.html under 'static' and application.properties under 'resources'.
I followed the instruction on jetBrains to Installing AngularJS Manually. 1.4.x stable
Created a folder and drag it to the WebStorm icon on my El Capitan dock.
Right click on the folder and created a new file and named it index.html
Added the ng-app directive to bootstrap the application to the html element.
Trying to get the context assist to help resolve the link to angular.js file which is located as a sibiling to the folder I created in step 2 above but do not see it in the list after hitting ^Space twice.
So I just typed it by hand
<!doctype html>
<html lang="en" ng-app>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="/../angular.js"></script>
</head>
<body>
Name: <input ng-model="username"/>{{username}}
</body>
</html>
But Chrome is showing the Binding with the expression inside it instead of evaluating it.
What am I doing wrong? Thanks
This JSFiddle works
<body ng-app>
Name: <input ng-model="username"/>{{username}}
</body>
so my assumption is that your reference to angular.js isn't being loaded in the browser because it is incorrect. You will need to link to a CDN for angular or place the angular.js file somewhere under your project directory. See the following for why External Libraries will not work as a reference. WebStorm: How can I link the HTML to an installed JS library?
I am working through a PackT book "AngularJS UI Development". Every thing has gone well, until I started working with Selenium/Protractor section on page 26 of 235. I have tried the solutions offered here on SO, but none of them have worked so far. Operating environment:
Protractor version 1.6.1
Node version 0.12.0
Karma version 0.12.31
AngularJS version 1.3.1
Windows 7 machine
Java (JRE) version 8 update 31
The error log says that protractor can not find AngularJS in my index.html file. This is my first time working with Protractor and Selenium.
I have my project up on github at github
So where have I gone wrong??? I would like to get through this and prove that angular development can be done here at a eLearning development company.
tony
index.htm :
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Hello World AngularUI</title>
<link rel='stylesheet' href='css/main.css' />
</head>
<body data-ng-app="myApp">
<div data-ng-controller="helloWorldCtrl">
<div hello-world name="name"></div>
<hello-world name='name'></hello-world>
</div>
<script src="bower/angular/angular.min.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src='js/directives.js'></script>
</body>
</html>
I looked at your git hub in your spec file (ch01/test/protractor/spec.j) you misspelled browser as broswer on line 3
I am new in JQuery Mobile. I really like it but I have 2 basic questions:
1- Can I test the app OFFLINE in my iPhone?
I know how to see the app when I am with an Internet connection even how to create the icon. But I don't see how to see the app i I don't have an Internet connection.
2- I suppose I can sent the html and css made with jQuery Mobile to Apple as any app. And it will work offline. Is that right?
Is there anyone with experience who have done apps with JQuery Mobile and are working in the app store?
Yes, you can have a jQuery Mobile page completely offline. Download the necessary libraries to your device. For the example I used the following
jquery-1.8.0.min.js
jquery.mobile-1.2.0.min.js
Additionally you need the jQuery Mobile CSS structure file
jquery.mobile.structure-1.2.0.min.css
Then use the theme roller to create your own CSS (or without changes just use the default jQuery CSS) and download it including the icon sets to your device. For the example I used this CSS name
taifun.min.css
The icon sets are stored in the subdirectory /images.
example code
<!DOCTYPE html>
<html>
<head>
<title>Offline</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="taifun.min.css" />
<link rel="stylesheet" href="jquery.mobile.structure-1.2.0.min.css" />
<script src="jquery-1.8.0.min.js"></script>
<script src="jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="content">
<h1>I'm a jQuery Mobile offline page</h1>
<ul data-role="listview">
<li>Acura</li>
<li>Audi</li>
<li>BMW</li>
<li>Cadillac</li>
</ul>
</div><!--/content -->
</body>
</html>
screenshot HTC Desire
#Brice Favre is right - testing 'offline' could be achieved by hosting your app on a LAN and accessing it using your iPhone through Wifi.
If you 'host' the app using e.g. PhoneGap, and include all the libaries (jQuery, jQuery Mobile) and CSS as part of your application, then your app will function just fine without an Internet connection - many apps work this way. See this PhoneGap tutorial.