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'; | |
/** | |
* @ngdoc function | |
* @name appApp.controller:AccountCtrl | |
* @description | |
* # AccountCtrl | |
* Controller of the appApp | |
*/ | |
angular.module('appApp') |
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
module.exports = function(app) { | |
var User = app.models.User; | |
// TODO: (1) find an example of how to add new "properties" to the built-in User mode via boot script | |
// (2) This is how you can add a "relationship" to the built-in User model via boot script | |
var SomeOtherModel = app.models.SomeOtherModel; | |
User.hasMany(SomeOtherModel, {as: 'someOtherModels', foreignKey: 'someOtherModelId'}); | |
// (3) This is how you can add "remote methods" to the built-in User model via boot script |
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
// for counting words in a string | |
var words="Hi there and hello there. Welcome and hello there."; | |
var wordcnt = words.replace(/[^\w\s]/g, "").split(/\s+/).reduce(function(map, word){ | |
map[word] = (map[word]||0)+1; | |
return map; | |
}, Object.create(null)); |