11 2014 档案
摘要:Using the Chrome console, you can access your AngularJS injectable services. This is down and dirty debugging, and can be a lifesaver in troubling tim...
阅读全文
摘要:Using Angular, you can actually access the scope and other things from the console, so when you have a live web page, you can dive in and grab things ...
阅读全文
摘要:Access Data From HTML {{todo.item}} /** * Created by Answer1215 on 11/29/2014. */function ToDoServices($q, $timeout) { var ToDoServic...
阅读全文
摘要:This function that we just set up is what's called a link function, and it's actually a very small part of a larger API. If I cut this and instead I r...
阅读全文
摘要:With Angular scopes, you have access to a$destroyevent that can be used to watch $scope events. This is used for cleanup, and gives you a final opport...
阅读全文
摘要:Hello Greensock! TweenMax.staggerTo() The start times of each animation are staggered by 0.5 seconds ...
阅读全文
摘要:AngularJS animations and TweenLite make it really easy to create cool 3d effects in your application. Hello Greensock! ...
阅读全文
摘要:There are situations where you might want to add additional methods toangular.module. This is easy to accomplish, and can be a handy technique. //F...
阅读全文
摘要:Annotation Order:It's considered good practice to dependency inject Angular's providers in before our own custom ones.Bad:// randomly ordered dependen...
阅读全文
摘要:Module definitionsAngular modules can be declared in various ways, either stored in a variable or using the getter syntax. Use the getter syntax at al...
阅读全文
摘要:Services:Services are instantiated and should be class-like also and reference thethiskeyword, keep function style consistent with everything else.Goo...
阅读全文
摘要:ControllerAs:Use thecontrollerAssyntax always as it aids in nested scoping and controller instance reference.Bad: {{ someObject }}Good: {{ main.some...
阅读全文
摘要:Also read:http://www.cnblogs.com/Answer1215/p/3941966.htmlUsing ngAnimate://!annotate="YourApp" Your AngularJS Module|Replace this or ngModule with th...
阅读全文
摘要:Using for..of statement:function* greeting(){ console.log(`Generators are "lazy"`); yield "How"; console.log(`I'm not called until the second...
阅读全文
摘要:Generators in ECMAscript 6 are first-class coroutines that produce encapsulated suspended execution(暂停执行) contexts.Yield values and iterate over them ...
阅读全文
摘要:The spread operator (...) allows you to "explode" an array into its individual elements.Spreate an array:console.log([1,2,3]); // [1, 2, 3] conso...
阅读全文
摘要:Where destructuring in ES6 allows you to easily get properties out of an object, this shorthand property syntax allows you to easily push properties i...
阅读全文
摘要:ECMAscript 6 lets us use string templates to gain a lot more control over strings in JavaScript.var salutation = "Hello";var place = "New York";var gr...
阅读全文
摘要:$intervalprovides an excellent service for timed operations in your AngularJS apps. It has the advantage over setInterval in "normal" Javascript in th...
阅读全文
摘要:ES6 decided that Array Comprehensions will not included in this version, ES7 will include this. Therefore, only FireFox support this, you can test it ...
阅读全文
摘要:Read More:http://es6.ruanyifeng.com/#docs/destructuringArray“模式匹配”,只要等号两边的模式相同,左边的变量就会被赋予对应的值:Exp 1:var [head, ...tail] = [1, 2, 3, 4];console.log(hea...
阅读全文
摘要:Here is the way you get value from an object:var obj = { color: "blue"}console.log(obj.color); //blueDestructuring Assignment:ObjectDestructuring ...
阅读全文
摘要:Normally, we can set default value for function param://Here use "Hello" as default paramvar receive =function(message="Hello", handle){ handler(me...
阅读全文
摘要:ES6 arrow function is somehow like CoffeeScirpt.CoffeeScript: //function callcoffee = -> coffee()coffee=(messag...
阅读全文
摘要:In ES6, IIFE is not necessary:// IIFE写法(function () { var tmp = ...; ...}());// 块级作用域写法{ let tmp = ...; ...}另外,ES6也规定,函数本身的作用域,在其所在的块级作用域之...
阅读全文
摘要:Fialdcase 1: let can work in it's block{ let a = 10; var b = 1;}a // ReferenceError: a is not defined.b //1Case 2: Let has no "Hosting" Problemf...
阅读全文
摘要:var message = "Hi";{ var message = "Bye"; }console.log(message); //ByeThe message inside the block still has impact on the outside.Just rememb...
阅读全文
摘要:When you minify your code with a tool like Uglify, the resulting minified file will rename variables. This is a problem for AngualrJS, which uses para...
阅读全文
摘要:Local Install:npm install -g traceurnpm install grunt-contrib-watchnpm install grunt-traceur-latestGruntFile:module.exports = function(grunt){ grun...
阅读全文
摘要:6.2Setting Up socket.io Server-SideSo far we've created an Express server. Now we want to start building a real-time Q&A moderation service and we've ...
阅读全文
摘要:Grunt will clean up your build with the grunt-contrib-clean to make sure that no artifacts from previous builds are hanging around. Install: npm insta
阅读全文
摘要:For production we want to use minified javascript to reduce the payload that is sent from the server. This can easily be accomplished with grunt-uglif...
阅读全文
摘要:Combine serval javascript files together.For angular project, make sure you add angular.min.js first, then app.js (which contains main module) second,...
阅读全文
摘要:With Grunt you can automate core tasks for your AngularJS project. In this lesson we will take a look at converting Stylus files to CSS, and add a wat...
阅读全文
摘要:Let's combine uglifying, watching, and config stuff into one Grunt file to make it more of a standard Grunt file.Install:npm install gruntnpm install ...
阅读全文
摘要:Grunt Uglify to compress your javascript for production deployment.Installnpm install grunt-contrib-uglifyExample/** * Created by Answer1215 on 11/15/...
阅读全文
摘要:/** * Created by Answer1215 on 11/15/2014. */module.exports = function(grunt){ grunt.initConfig({ files: ["'js'", "html"], compile: "...
阅读全文
摘要:Watch is an essential component of any Grunt build, and you will find yourself using it in almost every project.How to install?1. Install grunt first ...
阅读全文
摘要:getterSetter: boolean value which determines whether or not to treat functions bound to ngModel as getters/setters to have greater control over your m...
阅读全文
摘要:---恢复内容开始---ES6 is ECMAScript version 6, which JavaScript is based on. The next version of JavaScript is going to be based on version 6 of ECMAScript....
阅读全文
摘要:Installing RSpec In this level we'll start by getting you setup on a regular Ruby project, then move onto using RSpec within Rails. Let's start by ins
阅读全文
摘要:Install RSpec: Describe Lets start writing a specification for the Tweet class. Write a describe block for the Tweet model without any examples inside
阅读全文
摘要:This is an highlight about ngAira in Angular Document abou ngAiraWhere can use ngAria?Currently, ngAria interfaces with the following directives:ngMod...
阅读全文
摘要:Accessibility is an often overlookedessentialfeature of a web application. a11y Is a critical component of your AngularJS application. It should be co...
阅读全文
摘要:AngularJS 1.3 ng-model-options Some input: SubmitBound value: Field Error State: {{myForm.myField.$error | json...
阅读全文
摘要:new $q constructor Reject it Resolve it Last Resolved Value {{vm.resolveData | json}} Last Rejected Value {{vm.reje...
阅读全文
摘要:Password --------------------------------- //ngChange $scope.onChange=function(){ var newVal =...
阅读全文
摘要:$watchGroup can monitor an array or expression.We watch both email and password by using the same callback function. $scope.$watchGroup(['user.emai...
阅读全文
摘要:For the $watch in last article, we watch 'user.password', actually it is a string.If you watch 'user', this object and we do something like:function W...
阅读全文
摘要:/** * Created by Answer1215 on 11/13/2014. */function MainCtrl($scope){ function isLongEnough (pwd) { return pwd.length > 4; } functio...
阅读全文
摘要:FACTORIESConvert thezombiesfixture to a Factory GirlFactorycalled:zombie.test/fixture/zombies.ymlzombie: name: 'Sally' graveyard: 'Valley Dim'Answer...
阅读全文
摘要:Express RoutesLet's create an express route that acceptsGETrequests on'/tweets'and responds by sending back a static HTML file.Create aGETroute for'/t...
阅读全文
摘要:The idea: This post we are going to learn how to build a Firebase Forage with object related database.Form the pic we can see that there are two objec...
阅读全文
摘要:Using $firebaseSimpleLogin service.Here we use three methods for login, logout, register and getCurrentUser.Be sure to open the Email and Password con...
阅读全文
摘要:/** * Created by Answer1215 on 11/9/2014. */var app = angular.module('app', ['firebase']);app.constant('FIREBASE_URI', 'https://zhentiw-angular-fire.f...
阅读全文
摘要:Basic angularFire options: $save, $add and $remove.The way connect firebase:var app = angular.module('app', ['firebase']); var ref = new Firebase(F...
阅读全文
摘要:There are two ways to naviagting between state: 1. Using $state service, $state.go() 2. Using ui-serf diretive $state.go Inject $state service. .contr
阅读全文
摘要:When using ui-route, we want to pass the information with the url.Example:angular.module('categories.bookmarks', [ 'categories.bookmarks.create', ...
阅读全文
摘要:Question 1Consider the diagonal matrix M =100020000. Compute its Moore-Penrose pseudoinverse, and then identify, in the list below, the true statement...
阅读全文
摘要:AngularJS 1.3 add $submitted for form, so you can use $submitted to track whether the submit event is trggered.Read More:https://egghead.io/lessons/an...
阅读全文
摘要:Read More:http://www.linkplugapp.com/a/953215https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pubangular-hinthelps us w...
阅读全文
摘要:4.2Missing ExportsNotice the two different files:high_five.json the left side andapp.json the right. The code as it's written will not work,high_five....
阅读全文
摘要:In the previous post, we use $stateProvider deriect to root url and using MainCtrl, categories.tmpl.html. .config(function($stateProvider){ ...
阅读全文
摘要:1. Install ui-route, include js file in html and add dependence in js file.bower install angular-ui-routerangular.module('Eggly', [ 'ui.router', ...
阅读全文
摘要:Common models will be a sub models for category and bookmarks. Because they are used everywhere.For bookmarks edit and create, all they need is a comm...
阅读全文
摘要:We build a project according to its features or based on simple MVC structure. Put all controller into one folder and factory into another folder is h...
阅读全文
摘要:Question 1Note: In this question, all columns will be written in their transposed form, as rows, to make the typography simpler. Matrix M has three ro...
阅读全文
摘要:File Read StreamLets use thefsmodule to read a file and log its contents to the console.Use thefsmodule to create aReadablestream forfruits.txt. Store...
阅读全文
摘要:Chat EmitterWe're going to create a custom chat EventEmitter.Create a newEventEmitterobject and assign it to a variable called 'chat'.var chat = new E...
阅读全文
摘要:Note: Can use $dirty to check whether user has intracted with the form:https://docs.angularjs.org/api/ng/type/form.FormControllerRead More:http://www....
阅读全文
摘要:Question 1Here is a table of 1-5 star ratings for five movies (M, N, P. Q. R) by three raters (A, B, C).MNPQRA12345B23253C55532Normalize the ratings b...
阅读全文
摘要:RAILS INTEGRATION TESTUsing Rails integration test helpers complete the two tests below by calling thetweet_url(@tweet)path usingGET, and asserting as...
阅读全文