This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scope is used as the "glue" that we use to communicate between the parent controller, the directive, and the directive template. Whenever the AngularJS application is bootstrapped, a rootScope object is created. Each scope created by controllers, directives and services are prototypically inherited from rootScope. | |
Yes, we can limit the scope on a directive . We can do so by creating an isolated scope for directive. | |
There are 3 types of directive scopes: | |
1. Scope : False ( Directive uses its parent scope ) | |
2. Scope : True ( Directive gets a new scope ) | |
3. Scope : { } ( Directive gets a new isolated scope ) | |
Directives with the new isolated scope: When we create a new isolated scope then it will not be inherited from the parent scope. This new scope is called Isolated scope because it is completely detached from its parent scope. | |
Why? should we use isolated scope: We should use isolated scope when we want to create a custom directive because it will make sure that our directive is generic, and placed anywher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This function solves the Marco Polo Problem | |
// Input is number till which you want to print values | |
// Returns a single string which performs thee logic of Marco Polo. | |
function marcoPoloFunc(number){ | |
var retVal=''; | |
for(var i=1; i<=number;i++){ | |
if(i%4==0 && i%7==0) // checks if number is divisible by both 4 and 7 | |
retVal+='marcopolo' | |
else if(i%4==0) // checks if number is divisible by 4 | |
retVal+='marco' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('permission-module') | |
.factory('permissions', function ($rootScope) { | |
var permissionList; | |
return { | |
setPermissions: function (permissions) { | |
permissionList = permissions; | |
$rootScope.$broadcast('permissionsChanged'); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Declare app level module which depends on views, and components | |
var app = angular.module('eopd', [ | |
'ngRoute', | |
'app.directives' | |
'app.services' | |
]) | |
.config([ | |
'$locationProvider', '$routeProvider', '$httpProvider', 'ScrollBarsProvider', function ($locationProvider, $routeProvider, $httpProvider, ScrollBarsProvider) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It’s important to remember React is “just the V in MVC” or “just the view layer”. React isn’t trying to be a full fledged framework. | |
a)React.js Fundamentals: | |
1.Components are the building blocks of React. You can think of a component as a collection of HTML, CSS, JS, and some internal data specific to that component. | |
2.JSX — Allows us to write HTML like syntax which gets transformed to lightweight JavaScript objects. | |
3.Virtual DOM — A JavaScript representation of the actual DOM. | |
4.React.createClass — The way in which you create a new component. | |
5.render (method) — What we would like our HTML Template to look like. | |
6.ReactDOM.render — Renders a React component to a DOM node. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creating Immutable Objects: | |
Here are the following ways in which you can create immutable objects: | |
a) Object.assign : for creating immutable object | |
b) concat: for creating immutable array | |
c) filter: The filter() method creates an array filled with all array elements that pass a test (provided as a function). | |
var ages = [32, 33, 16, 40]; | |
function checkAdult(age) { | |
return age >= 18; | |
} | |
function myFunction() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CouchBase:=> | |
1. NoSql: Not only Sql | |
2. NoSql DataBase can store value in graph, document , key value nad column stores. | |
3. Couchbase fall under category of document base store. Faster retrieve | |
4. CAP Theorem: consistency , availabiloty and partition tolerance | |
5. Supports ACID over single document. Not good for heavy databases | |
6. Couchbase is a database that uses JSON for documents, JS for MapReduceQueries and regular Http for an API. | |
Additional Features supported: | |
1. Uses B-Tree Indexes |