Skip to content

Instantly share code, notes, and snippets.

View maxca's full-sized avatar
🏠
Working from home

samark chaisanguan maxca

🏠
Working from home
View GitHub Profile
https://gist.github.com/
วิธ๊การทำนั้นง่ายมาก ๆครับขั้นตอนที่ 1 เข้ามาที่เว็บไซต์
https://gist.github.com/
เนื้อหาของไฟล์
(function(){
var simpleApp = angular.module('simpleApp', []);
simpleApp.controller('simpleController', ['$location',function($location){
/** receive data */
var id = $location.search().id;
console.log(id);
/** send argument */
$location.path('/redirect-path').search('id','1234');
}]);
}());
/** config constant */
(function() {
var configModule = angular.module('configModule', []);
configModule.constant('config', {
local: {
baseApi: 'http://localhost',
port: '8080',
register: '/register'
timeOut: 1800,
},
/** use config app simple */
(function() {
var useConfigApp = angular.module('switchEnv', ['configModule']);
useConfigApp.Controllers('simpleController', ['serviceEnv', function(serviceEnv) {
var baseUrl = serviceEnv.env.baseApi;
var port = serviceEnv.env.port;
var register = serviceEnv.env.register;
var timeOut = serviceEnv.env.timeOut;
}]);
}());
/** switch env detect */
(function() {
var switchEnv = angular.module('switchEnv', ['useConfigApp']);
switchEnv.service('serviceEnv', ['config','$location', function(config,$location) {
this.env = function(host){
var host = !angular.isUndefined(host) ? host : $location.host();
switch(host) {
case 'local':
return config.local;
break;
<!DOCTYPE html>
<html ng-app="facebookAngularjs">
<head>
<title>Facebook authentification with angularJS By Samark Chaisanguan</title>
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/angular-route.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/config/moduleConfig.js"></script>
<script type="text/javascript" src="js/factory/facebookFactory.js"></script>
<script type="text/javascript" src="js/controllers/mainController.js"></script>
<div id="fb-root"></div>
<fb:login-button show-faces="true" max-rows="1" size="large"></fb:login-button>
{{ name }}
<br>
name: {{ list.item.name}}<br>
lastName: {{ list.item.lastName}}
<pre>
{{ list | json}}
</pre>
<pre>
@maxca
maxca / main.js
Last active October 20, 2016 10:26
(function() {
"use strict";
var facebookAngularjs = angular.module('facebookAngularjs', [
'ngRoute',
'mainController',
'moduleConfig',
]);
facebookAngularjs.config(function($routeProvider) {
$routeProvider.when('/index', {