Ecoer Logo
VOTING POWER100.00%
DOWNVOTE POWER100.00%
RESOURCE CREDITS100.00%
REPUTATION PROGRESS57.55%
Net Worth
0.306USD
STEEM
0.002STEEM
SBD
0.078SBD
Effective Power
5.699SP
├── Own SP
4.626SP
└── Incoming Deleg
+1.073SP

Detailed Balance

STEEM
balance
0.002STEEM
market_balance
0.000STEEM
savings_balance
0.000STEEM
reward_steem_balance
0.000STEEM
STEEM POWER
Own SP
4.626SP
Delegated Out
0.000SP
Delegation In
1.073SP
Effective Power
5.699SP
Reward SP (pending)
0.000SP
SBD
sbd_balance
0.078SBD
sbd_conversions
0.000SBD
sbd_market_balance
0.000SBD
savings_sbd_balance
0.000SBD
reward_sbd_balance
0.000SBD
{
  "balance": "0.002 STEEM",
  "savings_balance": "0.000 STEEM",
  "reward_steem_balance": "0.000 STEEM",
  "vesting_shares": "7522.182946 VESTS",
  "delegated_vesting_shares": "0.000000 VESTS",
  "received_vesting_shares": "1745.463246 VESTS",
  "sbd_balance": "0.078 SBD",
  "savings_sbd_balance": "0.000 SBD",
  "reward_sbd_balance": "0.000 SBD",
  "conversions": []
}

Account Info

namecoderlovely
id796353
rank209,955
reputation115863588631
created2018-03-02T21:24:36
recovery_accountsteem
proxyNone
post_count12
comment_count0
lifetime_vote_count0
witnesses_voted_for0
last_post2018-03-13T13:35:21
last_root_post2018-03-13T13:35:21
last_vote_time2018-03-03T16:01:24
proxied_vsf_votes0, 0, 0, 0
can_vote1
voting_power0
delayed_votes0
balance0.002 STEEM
savings_balance0.000 STEEM
sbd_balance0.078 SBD
savings_sbd_balance0.000 SBD
vesting_shares7522.182946 VESTS
delegated_vesting_shares0.000000 VESTS
received_vesting_shares1745.463246 VESTS
reward_vesting_balance0.000000 VESTS
vesting_balance0.000 STEEM
vesting_withdraw_rate0.000000 VESTS
next_vesting_withdrawal1969-12-31T23:59:59
withdrawn0
to_withdraw0
withdraw_routes0
savings_withdraw_requests0
last_account_recovery1970-01-01T00:00:00
reset_accountnull
last_owner_update2018-03-02T22:09:18
last_account_update2018-03-04T20:06:39
minedNo
sbd_seconds21,432,897
sbd_last_interest_payment2018-03-12T20:35:36
savings_sbd_last_interest_payment1970-01-01T00:00:00
{
  "active": {
    "account_auths": [],
    "key_auths": [
      [
        "STM55KGDtLYn6LoDTpYHzJP3ntjwqew2VvDCkGcPbDDti5BofkgqJ",
        1
      ]
    ],
    "weight_threshold": 1
  },
  "balance": "0.002 STEEM",
  "can_vote": true,
  "comment_count": 0,
  "created": "2018-03-02T21:24:36",
  "curation_rewards": 0,
  "delegated_vesting_shares": "0.000000 VESTS",
  "downvote_manabar": {
    "current_mana": 2316911548,
    "last_update_time": 1697484237
  },
  "guest_bloggers": [],
  "id": 796353,
  "json_metadata": "{\"profile\":{\"profile_image\":\"https://i.hizliresim.com/BLbMy9.jpg\",\"cover_image\":\"https://i.hizliresim.com/YgEB6l.jpg\",\"location\":\"ESKİSEHİR\"}}",
  "last_account_recovery": "1970-01-01T00:00:00",
  "last_account_update": "2018-03-04T20:06:39",
  "last_owner_update": "2018-03-02T22:09:18",
  "last_post": "2018-03-13T13:35:21",
  "last_root_post": "2018-03-13T13:35:21",
  "last_vote_time": "2018-03-03T16:01:24",
  "lifetime_vote_count": 0,
  "market_history": [],
  "memo_key": "STM8HZvacMZ8Q9DGuYD1cfrWLUfGjPfe8Kin74gpUEStZ6C6GWnya",
  "mined": false,
  "name": "coderlovely",
  "next_vesting_withdrawal": "1969-12-31T23:59:59",
  "other_history": [],
  "owner": {
    "account_auths": [],
    "key_auths": [
      [
        "STM7WsQbM7iPnqxqxxUmmbnTDi7uomqwY2WnWHP6Q3g63VV7Knr7q",
        1
      ]
    ],
    "weight_threshold": 1
  },
  "pending_claimed_accounts": 0,
  "post_bandwidth": 0,
  "post_count": 12,
  "post_history": [],
  "posting": {
    "account_auths": [
      [
        "utopian.app",
        1
      ]
    ],
    "key_auths": [
      [
        "STM5XqMjENbeusT1riittDSQqLxAN4m2EXrnL1xnZEFMXGuAog8cS",
        1
      ]
    ],
    "weight_threshold": 1
  },
  "posting_json_metadata": "{\"profile\":{\"profile_image\":\"https://i.hizliresim.com/BLbMy9.jpg\",\"cover_image\":\"https://i.hizliresim.com/YgEB6l.jpg\",\"location\":\"ESKİSEHİR\"}}",
  "posting_rewards": 7166,
  "proxied_vsf_votes": [
    0,
    0,
    0,
    0
  ],
  "proxy": "",
  "received_vesting_shares": "1745.463246 VESTS",
  "recovery_account": "steem",
  "reputation": "115863588631",
  "reset_account": "null",
  "reward_sbd_balance": "0.000 SBD",
  "reward_steem_balance": "0.000 STEEM",
  "reward_vesting_balance": "0.000000 VESTS",
  "reward_vesting_steem": "0.000 STEEM",
  "savings_balance": "0.000 STEEM",
  "savings_sbd_balance": "0.000 SBD",
  "savings_sbd_last_interest_payment": "1970-01-01T00:00:00",
  "savings_sbd_seconds": "0",
  "savings_sbd_seconds_last_update": "1970-01-01T00:00:00",
  "savings_withdraw_requests": 0,
  "sbd_balance": "0.078 SBD",
  "sbd_last_interest_payment": "2018-03-12T20:35:36",
  "sbd_seconds": "21432897",
  "sbd_seconds_last_update": "2018-04-08T19:03:39",
  "tags_usage": [],
  "to_withdraw": 0,
  "transfer_history": [],
  "vesting_balance": "0.000 STEEM",
  "vesting_shares": "7522.182946 VESTS",
  "vesting_withdraw_rate": "0.000000 VESTS",
  "vote_history": [],
  "voting_manabar": {
    "current_mana": "9267646192",
    "last_update_time": 1697484237
  },
  "voting_power": 0,
  "withdraw_routes": 0,
  "withdrawn": 0,
  "witness_votes": [],
  "witnesses_voted_for": 0,
  "rank": 209955
}

Withdraw Routes

IncomingOutgoing
Empty
Empty
{
  "incoming": [],
  "outgoing": []
}
From Date
To Date
steemdelegated 1.073 SP to @coderlovely
2023/10/16 19:23:57
delegateecoderlovely
delegatorsteem
vesting shares1745.463246 VESTS
Transaction InfoBlock #79053982/Trx 705a6cd024b9c590833f928d6755a867bd3eb6c2
View Raw JSON Data
{
  "block": 79053982,
  "op": [
    "delegate_vesting_shares",
    {
      "delegatee": "coderlovely",
      "delegator": "steem",
      "vesting_shares": "1745.463246 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2023-10-16T19:23:57",
  "trx_id": "705a6cd024b9c590833f928d6755a867bd3eb6c2",
  "trx_in_block": 2,
  "virtual_op": 0
}
steemdelegated 1.181 SP to @coderlovely
2020/11/02 12:49:42
delegateecoderlovely
delegatorsteem
vesting shares1920.017158 VESTS
Transaction InfoBlock #48254496/Trx ad0b6fed134064dbfb26d9b3aeef266ba5337343
View Raw JSON Data
{
  "block": 48254496,
  "op": [
    "delegate_vesting_shares",
    {
      "delegatee": "coderlovely",
      "delegator": "steem",
      "vesting_shares": "1920.017158 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2020-11-02T12:49:42",
  "trx_id": "ad0b6fed134064dbfb26d9b3aeef266ba5337343",
  "trx_in_block": 6,
  "virtual_op": 0
}
steemdelegated 1.380 SP to @coderlovely
2020/05/09 04:24:33
delegateecoderlovely
delegatorsteem
vesting shares2243.863303 VESTS
Transaction InfoBlock #43215478/Trx 2fb1eb1f4ff8b89e39ed395f02c708650e75e94e
View Raw JSON Data
{
  "block": 43215478,
  "op": [
    "delegate_vesting_shares",
    {
      "delegatee": "coderlovely",
      "delegator": "steem",
      "vesting_shares": "2243.863303 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2020-05-09T04:24:33",
  "trx_id": "2fb1eb1f4ff8b89e39ed395f02c708650e75e94e",
  "trx_in_block": 4,
  "virtual_op": 0
}
steemdelegated 1.201 SP to @coderlovely
2020/05/08 07:49:06
delegateecoderlovely
delegatorsteem
vesting shares1953.311140 VESTS
Transaction InfoBlock #43191349/Trx b52b3cc43cf6bda828451dafc94f7bac9c8e7c00
View Raw JSON Data
{
  "block": 43191349,
  "op": [
    "delegate_vesting_shares",
    {
      "delegatee": "coderlovely",
      "delegator": "steem",
      "vesting_shares": "1953.311140 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2020-05-08T07:49:06",
  "trx_id": "b52b3cc43cf6bda828451dafc94f7bac9c8e7c00",
  "trx_in_block": 12,
  "virtual_op": 0
}
2020/03/05 04:31:30
authorsteemitboard
bodyCongratulations @coderlovely! You received a personal award! <table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@coderlovely/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table> <sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@coderlovely) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=coderlovely)_</sub> **Do not miss the last post from @steemitboard:** <table><tr><td><a href="https://steemit.com/steemitboard/@steemitboard/use-your-witness-votes-and-get-the-community-badge"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmTugCUsoXX762vg1CuHRrpnPbfnjPogp8iCGv7F2kSVuj/image.png"></a></td><td><a href="https://steemit.com/steemitboard/@steemitboard/use-your-witness-votes-and-get-the-community-badge">Use your witness votes and get the Community Badge</a></td></tr></table> ###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
json metadata{"image":["https://steemitboard.com/img/notify.png"]}
parent authorcoderlovely
parent permlinkintegrate-twilio-sms-service-in-a-website-using-php
permlinksteemitboard-notify-coderlovely-20200305t043130000z
title
Transaction InfoBlock #41376281/Trx fb5e0a9bb81b0affa4028c74223bb17c4e92ed1d
View Raw JSON Data
{
  "block": 41376281,
  "op": [
    "comment",
    {
      "author": "steemitboard",
      "body": "Congratulations @coderlovely! You received a personal award!\n\n<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@coderlovely/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>\n\n<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@coderlovely) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=coderlovely)_</sub>\n\n\n**Do not miss the last post from @steemitboard:**\n<table><tr><td><a href=\"https://steemit.com/steemitboard/@steemitboard/use-your-witness-votes-and-get-the-community-badge\"><img src=\"https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmTugCUsoXX762vg1CuHRrpnPbfnjPogp8iCGv7F2kSVuj/image.png\"></a></td><td><a href=\"https://steemit.com/steemitboard/@steemitboard/use-your-witness-votes-and-get-the-community-badge\">Use your witness votes and get the Community Badge</a></td></tr></table>\n\n###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!",
      "json_metadata": "{\"image\":[\"https://steemitboard.com/img/notify.png\"]}",
      "parent_author": "coderlovely",
      "parent_permlink": "integrate-twilio-sms-service-in-a-website-using-php",
      "permlink": "steemitboard-notify-coderlovely-20200305t043130000z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2020-03-05T04:31:30",
  "trx_id": "fb5e0a9bb81b0affa4028c74223bb17c4e92ed1d",
  "trx_in_block": 6,
  "virtual_op": 0
}
steemdelegated 1.491 SP to @coderlovely
2019/06/28 23:33:51
delegateecoderlovely
delegatorsteem
vesting shares2424.968463 VESTS
Transaction InfoBlock #34207879/Trx 92489d937260ab1a0ec2d6d4bc6d5f340a4971e1
View Raw JSON Data
{
  "block": 34207879,
  "op": [
    "delegate_vesting_shares",
    {
      "delegatee": "coderlovely",
      "delegator": "steem",
      "vesting_shares": "2424.968463 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2019-06-28T23:33:51",
  "trx_id": "92489d937260ab1a0ec2d6d4bc6d5f340a4971e1",
  "trx_in_block": 12,
  "virtual_op": 0
}
2019/03/02 23:42:51
authorsteemitboard
bodyCongratulations @coderlovely! You received a personal award! <table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@coderlovely/birthday1.png</td><td>Happy Birthday! - You are on the Steem blockchain for 1 year!</td></tr></table> <sub>_[Click here to view your Board](https://steemitboard.com/@coderlovely)_</sub> **Do not miss the last post from @steemitboard:** <table><tr><td><a href="https://steemit.com/carnival/@steemitboard/carnival-2019"><img src="https://steemitimages.com/64x128/http://i.cubeupload.com/rltzHT.png"></a></td><td><a href="https://steemit.com/carnival/@steemitboard/carnival-2019">Carnival Challenge - Collect badge and win 5 STEEM</a></td></tr></table> ###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) and get one more award and increased upvotes!
json metadata{"image":["https://steemitboard.com/img/notify.png"]}
parent authorcoderlovely
parent permlinkintegrate-twilio-sms-service-in-a-website-using-php
permlinksteemitboard-notify-coderlovely-20190302t234250000z
title
Transaction InfoBlock #30814083/Trx 702da7c2674c6ee29d265796553f797411ba6820
View Raw JSON Data
{
  "block": 30814083,
  "op": [
    "comment",
    {
      "author": "steemitboard",
      "body": "Congratulations @coderlovely! You received a personal award!\n\n<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@coderlovely/birthday1.png</td><td>Happy Birthday! - You are on the Steem blockchain for 1 year!</td></tr></table>\n\n<sub>_[Click here to view your Board](https://steemitboard.com/@coderlovely)_</sub>\n\n\n**Do not miss the last post from @steemitboard:**\n<table><tr><td><a href=\"https://steemit.com/carnival/@steemitboard/carnival-2019\"><img src=\"https://steemitimages.com/64x128/http://i.cubeupload.com/rltzHT.png\"></a></td><td><a href=\"https://steemit.com/carnival/@steemitboard/carnival-2019\">Carnival Challenge - Collect badge and win 5 STEEM</a></td></tr></table>\n\n###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) and get one more award and increased upvotes!",
      "json_metadata": "{\"image\":[\"https://steemitboard.com/img/notify.png\"]}",
      "parent_author": "coderlovely",
      "parent_permlink": "integrate-twilio-sms-service-in-a-website-using-php",
      "permlink": "steemitboard-notify-coderlovely-20190302t234250000z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2019-03-02T23:42:51",
  "trx_id": "702da7c2674c6ee29d265796553f797411ba6820",
  "trx_in_block": 6,
  "virtual_op": 0
}
steemdelegated 1.614 SP to @coderlovely
2018/07/08 21:23:12
delegateecoderlovely
delegatorsteem
vesting shares2623.914693 VESTS
Transaction InfoBlock #24006351/Trx 43290a3fa42836c9ddc9b0eb5b0d382b25dccdf0
View Raw JSON Data
{
  "block": 24006351,
  "op": [
    "delegate_vesting_shares",
    {
      "delegatee": "coderlovely",
      "delegator": "steem",
      "vesting_shares": "2623.914693 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-07-08T21:23:12",
  "trx_id": "43290a3fa42836c9ddc9b0eb5b0d382b25dccdf0",
  "trx_in_block": 29,
  "virtual_op": 0
}
steemdelegated 14.136 SP to @coderlovely
2018/05/25 14:22:45
delegateecoderlovely
delegatorsteem
vesting shares22986.513055 VESTS
Transaction InfoBlock #22741541/Trx 41c811e59a49735856ab5705fffa1afc4065fe75
View Raw JSON Data
{
  "block": 22741541,
  "op": [
    "delegate_vesting_shares",
    {
      "delegatee": "coderlovely",
      "delegator": "steem",
      "vesting_shares": "22986.513055 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-05-25T14:22:45",
  "trx_id": "41c811e59a49735856ab5705fffa1afc4065fe75",
  "trx_in_block": 35,
  "virtual_op": 0
}
coderlovelyclaimed reward balance: 0.001 STEEM, 0.078 SBD, 0.053 SP
2018/04/08 19:03:39
accountcoderlovely
reward sbd0.078 SBD
reward steem0.001 STEEM
reward vests85.728379 VESTS
Transaction InfoBlock #21394820/Trx 6eb5d4046d455380b8dd96ab9e3963fa9eaeebad
View Raw JSON Data
{
  "block": 21394820,
  "op": [
    "claim_reward_balance",
    {
      "account": "coderlovely",
      "reward_sbd": "0.078 SBD",
      "reward_steem": "0.001 STEEM",
      "reward_vests": "85.728379 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-04-08T19:03:39",
  "trx_id": "6eb5d4046d455380b8dd96ab9e3963fa9eaeebad",
  "trx_in_block": 38,
  "virtual_op": 0
}
coderlovelyreceived 0.001 STEEM, 0.029 SBD, 0.021 SP author reward for @coderlovely / how-to-use-usdwatch-angularjs-tutorial
2018/03/18 22:58:36
authorcoderlovely
permlinkhow-to-use-usdwatch-angularjs-tutorial
sbd payout0.029 SBD
steem payout0.001 STEEM
vesting payout34.699075 VESTS
Transaction InfoBlock #20795660/Virtual Operation #8
View Raw JSON Data
{
  "block": 20795660,
  "op": [
    "author_reward",
    {
      "author": "coderlovely",
      "permlink": "how-to-use-usdwatch-angularjs-tutorial",
      "sbd_payout": "0.029 SBD",
      "steem_payout": "0.001 STEEM",
      "vesting_payout": "34.699075 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-18T22:58:36",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 8
}
utopian.payreceived 0.013 SP benefactor reward from @coderlovely
2018/03/18 22:58:36
authorcoderlovely
benefactorutopian.pay
permlinkhow-to-use-usdwatch-angularjs-tutorial
sbd payout0.000 SBD
steem payout0.000 STEEM
vesting payout20.411220 VESTS
Transaction InfoBlock #20795660/Virtual Operation #7
View Raw JSON Data
{
  "block": 20795660,
  "op": [
    "comment_benefactor_reward",
    {
      "author": "coderlovely",
      "benefactor": "utopian.pay",
      "permlink": "how-to-use-usdwatch-angularjs-tutorial",
      "sbd_payout": "0.000 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "20.411220 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-18T22:58:36",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 7
}
coderlovelyreceived 0.037 SBD, 0.024 SP author reward for @coderlovely / how-to-repeat-html-elements-in-angularjs
2018/03/18 15:03:15
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
sbd payout0.037 SBD
steem payout0.000 STEEM
vesting payout38.781995 VESTS
Transaction InfoBlock #20786153/Virtual Operation #10
View Raw JSON Data
{
  "block": 20786153,
  "op": [
    "author_reward",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "sbd_payout": "0.037 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "38.781995 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-18T15:03:15",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 10
}
utopian.payreceived 0.015 SP benefactor reward from @coderlovely
2018/03/18 15:03:15
authorcoderlovely
benefactorutopian.pay
permlinkhow-to-repeat-html-elements-in-angularjs
sbd payout0.000 SBD
steem payout0.000 STEEM
vesting payout24.493891 VESTS
Transaction InfoBlock #20786153/Virtual Operation #9
View Raw JSON Data
{
  "block": 20786153,
  "op": [
    "comment_benefactor_reward",
    {
      "author": "coderlovely",
      "benefactor": "utopian.pay",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "sbd_payout": "0.000 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "24.493891 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-18T15:03:15",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 9
}
2018/03/18 01:33:48
authorcoderlovely
permlinkhow-to-write-a-single-page-app-with-different-views-in-angularjs
sbd payout0.012 SBD
steem payout0.000 STEEM
vesting payout12.247309 VESTS
Transaction InfoBlock #20769967/Virtual Operation #4
View Raw JSON Data
{
  "block": 20769967,
  "op": [
    "author_reward",
    {
      "author": "coderlovely",
      "permlink": "how-to-write-a-single-page-app-with-different-views-in-angularjs",
      "sbd_payout": "0.012 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "12.247309 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-18T01:33:48",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 4
}
utopian.payreceived 0.004 SP benefactor reward from @coderlovely
2018/03/18 01:33:48
authorcoderlovely
benefactorutopian.pay
permlinkhow-to-write-a-single-page-app-with-different-views-in-angularjs
sbd payout0.000 SBD
steem payout0.000 STEEM
vesting payout6.123654 VESTS
Transaction InfoBlock #20769967/Virtual Operation #3
View Raw JSON Data
{
  "block": 20769967,
  "op": [
    "comment_benefactor_reward",
    {
      "author": "coderlovely",
      "benefactor": "utopian.pay",
      "permlink": "how-to-write-a-single-page-app-with-different-views-in-angularjs",
      "sbd_payout": "0.000 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "6.123654 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-18T01:33:48",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 3
}
2018/03/14 00:00:03
authorportugalcoin
bodyDeleted!
json metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
parent authorcoderlovely
parent permlinkhow-to-repeat-html-elements-in-angularjs
permlinkre-coderlovely-how-to-repeat-html-elements-in-angularjs-20180311t220922246z
title
Transaction InfoBlock #20653023/Trx 3465377f69ab576f547e73050c1dc47729d54a9a
View Raw JSON Data
{
  "block": 20653023,
  "op": [
    "comment",
    {
      "author": "portugalcoin",
      "body": "Deleted!",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"utopian\",\"app\":\"utopian/1.0.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "how-to-repeat-html-elements-in-angularjs",
      "permlink": "re-coderlovely-how-to-repeat-html-elements-in-angularjs-20180311t220922246z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-14T00:00:03",
  "trx_id": "3465377f69ab576f547e73050c1dc47729d54a9a",
  "trx_in_block": 0,
  "virtual_op": 0
}
2018/03/13 17:28:27
authorcoderlovely
permlinkintegrate-twilio-sms-service-in-a-website-using-php
votermarketstack
weight800 (8.00%)
Transaction InfoBlock #20645193/Trx 835a29135aed100b36d964b22bf07e2f842f80d1
View Raw JSON Data
{
  "block": 20645193,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "integrate-twilio-sms-service-in-a-website-using-php",
      "voter": "marketstack",
      "weight": 800
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-13T17:28:27",
  "trx_id": "835a29135aed100b36d964b22bf07e2f842f80d1",
  "trx_in_block": 30,
  "virtual_op": 0
}
2018/03/13 17:00:36
authorarie.steem
bodyYour contribution cannot be approved because it does not follow the [Utopian Rules](https://utopian.io/rules). * you already get banned because doing plagiarism before : https://utopian.io/utopian-io/@coderlovely/methods-of-creating-a-web-part-page * and all of your contribution will be rejected. You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
json metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
parent authorcoderlovely
parent permlinkintegrate-twilio-sms-service-in-a-website-using-php
permlinkre-coderlovely-integrate-twilio-sms-service-in-a-website-using-php-20180313t170034050z
title
Transaction InfoBlock #20644636/Trx 0d3b5607651c3104f8409e253d56d98ed9662438
View Raw JSON Data
{
  "block": 20644636,
  "op": [
    "comment",
    {
      "author": "arie.steem",
      "body": "Your contribution cannot be approved because it does not follow the [Utopian Rules](https://utopian.io/rules).\n\n* you already get banned because doing plagiarism before : https://utopian.io/utopian-io/@coderlovely/methods-of-creating-a-web-part-page\n* and all of your contribution will be rejected.\n\n\nYou can contact us on [Discord](https://discord.gg/uTyJkNm).\n**[[utopian-moderator]](https://utopian.io/moderators)**",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"utopian\",\"app\":\"utopian/1.0.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "integrate-twilio-sms-service-in-a-website-using-php",
      "permlink": "re-coderlovely-integrate-twilio-sms-service-in-a-website-using-php-20180313t170034050z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-13T17:00:36",
  "trx_id": "0d3b5607651c3104f8409e253d56d98ed9662438",
  "trx_in_block": 40,
  "virtual_op": 0
}
2018/03/13 16:59:30
authorcoderlovely
body**What Will I Learn?** Now we are going to learn how to setup and use Twilio for sending text messages to single/multiple recipients. **Requirements** PHP Server Basic knowledge about PHP **Difficulty** Basic Many people want to integrate Short Messaging Service into web applications to send notifications, promotions, reminders to their clients or members from their websites. This can be done using Twilio. Twilio is a cloud communications company that allows developers to programmatically send and receive text messages and make and receive phone calls using its web service APIs. Now we are going to learn how to setup and use Twilio for sending text messages to single/multiple recipients. ![](https://i.hizliresim.com/Z9RrRZ.png) In this project I have used The Twilio PHP Helper Library by Twilio. Let’s start with setting up Twilio account first Twilio Account Setup: Step 1: Go for http://twilio.com and Signup for a new Twilio account or Sign in if you already have one. Step 2: To get started with Twilio you can sign up for a trial account at https://www.twilio.com/try-twilio. Step 3: Verify your phone number as an outbound caller ID with Twilio. For information on how to verify your phone number, see https://www.twilio.com/user/account/phone-numbers/verified#. For purposes of this example, use the verified phone number as text message recipient in this application. Note: If you are using a trial account, then its compulsory to use only your own verified phone number for receiving text messages. As an alternative to using an existing number, you can purchase a Twilio phone number. Step 4: Get account SID and Auth Token from https://www.twilio.com/user/account which will be used in this application. ![](https://i.hizliresim.com/lORo8X.png) Step 5: Get your Twilio account phone number from https://www.twilio.com/user/account/phone-numbers/incoming which will be used as sender in text messages. ![](https://i.hizliresim.com/G9XqJ2.png) **PHP Code:** We will be working with config.php, example.php, integrate.php and functions.php. Proper understanding of these files is necessary. **config.php:** ``` language <?php // enter your SID obtained from Twilio account $sid = " your_account_sid "; // enter AUTH Token obtained from Twilio $token = " your_authentication_token "; //Your valid twilio number $my_number = "+12000000000"; ?> ``` **functions.php:** This file has two functions. **send_message** function is used to send message to a single recipient. It has two parameters ($receiver and $message). $receiver contains number to which text message will be sent. $message is body of the message. **send_multiple_message** function is used to send text messages to multiple recipients. It also has two parameters, the only difference is that $receiver has multiple recipients separated with a comma( , ). ``` language <?php // This function will be used to send message to single recipient. function send_message($receiver, $message) { require "config.php"; require './twilio-php/Services/Twilio.php'; $client = new Services_Twilio($sid, $token); $result = $client->account->messages->sendMessage( $my_number, // From a valid Twilio number $receiver, // Text this number $message ); return $result->sid; } // This function will be used to send message to multiple recipient. function send_multiple_message($receiver, $message) { require "config.php"; require './twilio-php/Services/Twilio.php'; $numbers = explode("," , $receiver); $receipt = array(); $count = 0; foreach($numbers AS $num) { $client = new Services_Twilio($sid, $token); $result = $client->account->messages->sendMessage( $my_number, // From a valid Twilio number trim($num), // Text this number $message ); $receipt[$count]["num"] = $num; $receipt[$count]["sid"] = $result->sid; } return $receipt; } ?> ``` **example.php:** This file can send message to a single recipient. HTML Form with $_POST method is used to send data. ``` language <?php require_once("functions.php"); if(isset($_POST['receiver'])) { $receiver = $_POST['receiver']; } if(isset($_POST['message'])) { $message = $_POST['message']; } if(isset($receiver) && isset($message) && !empty($message) && !empty($receiver)) { $result = send_message($receiver,$message); if($result) { echo "<h2>Message Sent....</h2><br />SID Returned By Twillio is: $result"; } } ?> <h1>To send Text Message to multiple recipients <a href="multi.php" >Click Here</a></h1><br /> <div class="box"> <script type="text/javascript"> function submit() { document.getElementById("sendsms").submit(); } </script> <form name="sendsms" id="sendsms" action="" method="post"> Send To:&nbsp;&nbsp;&nbsp;<input name="receiver" type="text" /><br /><br /> Message:&nbsp;&nbsp;<textarea style="width: 400px;height:60px;" name="message" ></textarea><br /> <span style="color: #fff;">Message length:160 characters max..</span><br /> <span ><input class="button" type="button" value="Send SMS..." onclick="submit();" /></span> </form> </div> ``` **integrate.php:** If you want to send message without HTML Form use below code in any desired PHP file. ``` language <?PHP // include function.php file which contains all functions and SDK files require_once("functions.php"); $receiver = "enter number here"; // example +1589658452 $message = "enter message here"; // max character limit 160 if(isset($receiver) && isset($message) && !empty($message) && !empty($receiver)) { //run the function which will send message to recipient using Twilio. $result = send_message($receiver,$message); if($result) { // output the SID received from Twilio echo "<h2>Message Sent....</h2><br />SID Returned By Twilio is: $result"; } } ``` <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/integrate-twilio-sms-service-in-a-website-using-php">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":3242728,"name":"web-php","full_name":"php/web-php","html_url":"https://github.com/php/web-php","fork":false,"owner":{"login":"php"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio","php"],"moderator":{"account":"arie.steem","time":"2018-03-13T16:59:31.156Z","flagged":true,"reviewed":false,"pending":false},"questions":[],"score":null}
parent author
parent permlinkutopian-io
permlinkintegrate-twilio-sms-service-in-a-website-using-php
titleIntegrate Twilio SMS Service in a Website using PHP
Transaction InfoBlock #20644614/Trx 85d02f53fcea665ba8f8afd0d8b2ba2e94c09d5c
View Raw JSON Data
{
  "block": 20644614,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\nNow we are going to learn how to setup and use Twilio for sending text messages to single/multiple recipients.\n\n**Requirements**\nPHP Server\nBasic knowledge about PHP\n\n**Difficulty**\nBasic\n\nMany people want to integrate Short Messaging Service into web applications to send notifications, promotions, reminders to their clients or members from their websites. This can be done using Twilio. Twilio is a cloud communications company that allows developers to programmatically send and receive text messages and make and receive phone calls using its web service APIs. Now we are going to learn how to setup and use Twilio for sending text messages to single/multiple recipients.\n\n![](https://i.hizliresim.com/Z9RrRZ.png)\n\nIn this project I have used The Twilio PHP Helper Library by Twilio. Let’s start with setting up Twilio account first\n\nTwilio Account Setup:\nStep 1: Go for http://twilio.com and Signup for a new Twilio account or Sign in if you already have one.\n\nStep 2: To get started with Twilio you can sign up for a trial account at https://www.twilio.com/try-twilio.\n\nStep 3: Verify your phone number as an outbound caller ID with Twilio. For information on how to verify your phone number, see https://www.twilio.com/user/account/phone-numbers/verified#. For purposes of this example, use the verified phone number as text message recipient in this application.\n\nNote: If you are using a trial account, then its compulsory to use only your own verified phone number for receiving text messages. As an alternative to using an existing number, you can purchase a Twilio phone number.\n\nStep 4: Get account SID and Auth Token from https://www.twilio.com/user/account which will be used in this application.\n\n![](https://i.hizliresim.com/lORo8X.png)\n\nStep 5: Get your Twilio account phone number from https://www.twilio.com/user/account/phone-numbers/incoming which will be used as sender in text messages.\n\n![](https://i.hizliresim.com/G9XqJ2.png)\n\n**PHP Code:**\n\nWe will be working with config.php, example.php, integrate.php and functions.php. Proper understanding of these files is necessary.\n\n**config.php:**\n\n``` language\n<?php\n\n// enter your SID obtained from Twilio account\n$sid = \" your_account_sid \"; \n \n // enter AUTH Token obtained from Twilio\n$token = \" your_authentication_token \";\n\n//Your valid twilio number\n$my_number = \"+12000000000\";\n\n?>\n```\n\n**functions.php:**\n\nThis file has two functions. **send_message** function is used to send message to a single recipient. It has two parameters ($receiver and $message). $receiver contains number to which text message will be sent. $message is body of the message.\n\n**send_multiple_message** function is used to send text messages to multiple recipients. It also has two parameters, the only difference is that $receiver has multiple recipients separated with a comma( , ).\n\n``` language\n<?php\n// This function will be used to send message to single recipient.\nfunction send_message($receiver, $message)\n{\n    require \"config.php\";\n    require './twilio-php/Services/Twilio.php';\n    $client = new Services_Twilio($sid, $token);\n    $result = $client->account->messages->sendMessage(\n      $my_number, // From a valid Twilio number\n      $receiver, // Text this number\n      $message\n    );\n    \n    return $result->sid;  \n    \n}\n\n// This function will be used to send message to multiple recipient.\nfunction send_multiple_message($receiver, $message)\n{\n    require \"config.php\";\n    require './twilio-php/Services/Twilio.php';\n    $numbers  =  explode(\",\" , $receiver);\n    $receipt = array();\n    $count = 0;\n    foreach($numbers AS $num)\n    {\n        \n        $client = new Services_Twilio($sid, $token);\n        $result = $client->account->messages->sendMessage(\n          $my_number, // From a valid Twilio number\n          trim($num), // Text this number\n          $message\n        );\n        \n        $receipt[$count][\"num\"] = $num;\n        $receipt[$count][\"sid\"] = $result->sid;\n        \n    }\n  \n    return $receipt;\n    \n}\n\n?>\n```\n\n**example.php:**\n\nThis file can send message to a single recipient. HTML Form with $_POST method is used to send data.\n\n``` language\n<?php\n\nrequire_once(\"functions.php\");\n\nif(isset($_POST['receiver']))\n{\n    $receiver = $_POST['receiver'];\n}\n\nif(isset($_POST['message']))\n{\n    $message = $_POST['message'];\n}\n\n\n\nif(isset($receiver) && isset($message) && !empty($message) && !empty($receiver))\n{\n  $result = send_message($receiver,$message);\n  if($result)\n  {\n    echo \"<h2>Message Sent....</h2><br />SID Returned By Twillio is: $result\";\n  }\n  \n} \n\n?>\n\n<h1>To send Text Message to multiple recipients <a href=\"multi.php\" >Click Here</a></h1><br />\n\n<div class=\"box\">\n<script type=\"text/javascript\">\nfunction submit()\n{\n    document.getElementById(\"sendsms\").submit();\n}\n</script>\n\n<form name=\"sendsms\" id=\"sendsms\" action=\"\" method=\"post\">\nSend To:&nbsp;&nbsp;&nbsp;<input name=\"receiver\" type=\"text\" /><br /><br />\nMessage:&nbsp;&nbsp;<textarea style=\"width: 400px;height:60px;\" name=\"message\" ></textarea><br />\n<span style=\"color: #fff;\">Message length:160 characters max..</span><br />\n<span ><input class=\"button\" type=\"button\" value=\"Send SMS...\" onclick=\"submit();\" /></span>\n</form>\n</div>\n```\n\n**integrate.php:**\n\nIf you want to send message without HTML Form use below code in any desired PHP file.\n\n``` language\n<?PHP\n// include function.php file which contains all functions and SDK files\nrequire_once(\"functions.php\");\n\n$receiver = \"enter number here\"; // example +1589658452\n$message = \"enter message here\"; // max character limit 160\n\nif(isset($receiver) && isset($message) && !empty($message) && !empty($receiver))\n{\n  //run the function which will send message to recipient using Twilio.\n  $result = send_message($receiver,$message);\n  if($result)\n  {\n    // output the SID received from Twilio\n    echo \"<h2>Message Sent....</h2><br />SID Returned By Twilio is: $result\";\n  }\n  \n}\n```\n\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/integrate-twilio-sms-service-in-a-website-using-php\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":3242728,\"name\":\"web-php\",\"full_name\":\"php/web-php\",\"html_url\":\"https://github.com/php/web-php\",\"fork\":false,\"owner\":{\"login\":\"php\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\",\"php\"],\"moderator\":{\"account\":\"arie.steem\",\"time\":\"2018-03-13T16:59:31.156Z\",\"flagged\":true,\"reviewed\":false,\"pending\":false},\"questions\":[],\"score\":null}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "integrate-twilio-sms-service-in-a-website-using-php",
      "title": "Integrate Twilio SMS Service in a Website using PHP"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-13T16:59:30",
  "trx_id": "85d02f53fcea665ba8f8afd0d8b2ba2e94c09d5c",
  "trx_in_block": 30,
  "virtual_op": 0
}
2018/03/13 16:47:36
authorarie.steem
bodyI found your doing plagiarism [HERE](https://utopian.io/utopian-io/@mrsx7/understanding-the-methods-of-creating-a-web-part-page-asp-net-tutorial) you have misused the utopian and this is a violation You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
json metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
parent authorcoderlovely
parent permlinkmethods-of-creating-a-web-part-page
permlinkre-coderlovely-methods-of-creating-a-web-part-page-20180313t164735424z
title
Transaction InfoBlock #20644376/Trx 9a855e75bd68508a1b9fe84a520db1acfed9d97d
View Raw JSON Data
{
  "block": 20644376,
  "op": [
    "comment",
    {
      "author": "arie.steem",
      "body": "I found your doing plagiarism [HERE](https://utopian.io/utopian-io/@mrsx7/understanding-the-methods-of-creating-a-web-part-page-asp-net-tutorial) \nyou have misused the utopian and this is a violation\n\nYou can contact us on [Discord](https://discord.gg/uTyJkNm).\n**[[utopian-moderator]](https://utopian.io/moderators)**",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"utopian\",\"app\":\"utopian/1.0.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "methods-of-creating-a-web-part-page",
      "permlink": "re-coderlovely-methods-of-creating-a-web-part-page-20180313t164735424z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-13T16:47:36",
  "trx_id": "9a855e75bd68508a1b9fe84a520db1acfed9d97d",
  "trx_in_block": 33,
  "virtual_op": 0
}
2018/03/13 15:14:15
authorcoderlovely
permlinkintegrate-twilio-sms-service-in-a-website-using-php
votersandan
weight10000 (100.00%)
Transaction InfoBlock #20642509/Trx f8e6d8b58620223e7e09fc241d024e812a82001f
View Raw JSON Data
{
  "block": 20642509,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "integrate-twilio-sms-service-in-a-website-using-php",
      "voter": "sandan",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-13T15:14:15",
  "trx_id": "f8e6d8b58620223e7e09fc241d024e812a82001f",
  "trx_in_block": 44,
  "virtual_op": 0
}
2018/03/13 13:51:27
authorcoderlovely
permlinkintegrate-twilio-sms-service-in-a-website-using-php
voterumich
weight1200 (12.00%)
Transaction InfoBlock #20640854/Trx b44e907ec446312c91799165802d8777724ca7c4
View Raw JSON Data
{
  "block": 20640854,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "integrate-twilio-sms-service-in-a-website-using-php",
      "voter": "umich",
      "weight": 1200
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-13T13:51:27",
  "trx_id": "b44e907ec446312c91799165802d8777724ca7c4",
  "trx_in_block": 42,
  "virtual_op": 0
}
2018/03/13 13:35:21
allow curation rewardstrue
allow votestrue
authorcoderlovely
extensions[[0,{"beneficiaries":[{"account":"utopian.pay","weight":2500}]}]]
max accepted payout1000000.000 SBD
percent steem dollars10000
permlinkintegrate-twilio-sms-service-in-a-website-using-php
Transaction InfoBlock #20640532/Trx c7724beceda66af87010af3aae7624ee53870a5f
View Raw JSON Data
{
  "block": 20640532,
  "op": [
    "comment_options",
    {
      "allow_curation_rewards": true,
      "allow_votes": true,
      "author": "coderlovely",
      "extensions": [
        [
          0,
          {
            "beneficiaries": [
              {
                "account": "utopian.pay",
                "weight": 2500
              }
            ]
          }
        ]
      ],
      "max_accepted_payout": "1000000.000 SBD",
      "percent_steem_dollars": 10000,
      "permlink": "integrate-twilio-sms-service-in-a-website-using-php"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-13T13:35:21",
  "trx_id": "c7724beceda66af87010af3aae7624ee53870a5f",
  "trx_in_block": 10,
  "virtual_op": 0
}
2018/03/13 13:35:21
authorcoderlovely
body**What Will I Learn?** Now we are going to learn how to setup and use Twilio for sending text messages to single/multiple recipients. **Requirements** PHP Server Basic knowledge about PHP **Difficulty** Basic Many people want to integrate Short Messaging Service into web applications to send notifications, promotions, reminders to their clients or members from their websites. This can be done using Twilio. Twilio is a cloud communications company that allows developers to programmatically send and receive text messages and make and receive phone calls using its web service APIs. Now we are going to learn how to setup and use Twilio for sending text messages to single/multiple recipients. ![](https://i.hizliresim.com/Z9RrRZ.png) In this project I have used The Twilio PHP Helper Library by Twilio. Let’s start with setting up Twilio account first Twilio Account Setup: Step 1: Go for http://twilio.com and Signup for a new Twilio account or Sign in if you already have one. Step 2: To get started with Twilio you can sign up for a trial account at https://www.twilio.com/try-twilio. Step 3: Verify your phone number as an outbound caller ID with Twilio. For information on how to verify your phone number, see https://www.twilio.com/user/account/phone-numbers/verified#. For purposes of this example, use the verified phone number as text message recipient in this application. Note: If you are using a trial account, then its compulsory to use only your own verified phone number for receiving text messages. As an alternative to using an existing number, you can purchase a Twilio phone number. Step 4: Get account SID and Auth Token from https://www.twilio.com/user/account which will be used in this application. ![](https://i.hizliresim.com/lORo8X.png) Step 5: Get your Twilio account phone number from https://www.twilio.com/user/account/phone-numbers/incoming which will be used as sender in text messages. ![](https://i.hizliresim.com/G9XqJ2.png) **PHP Code:** We will be working with config.php, example.php, integrate.php and functions.php. Proper understanding of these files is necessary. **config.php:** ``` language <?php // enter your SID obtained from Twilio account $sid = " your_account_sid "; // enter AUTH Token obtained from Twilio $token = " your_authentication_token "; //Your valid twilio number $my_number = "+12000000000"; ?> ``` **functions.php:** This file has two functions. **send_message** function is used to send message to a single recipient. It has two parameters ($receiver and $message). $receiver contains number to which text message will be sent. $message is body of the message. **send_multiple_message** function is used to send text messages to multiple recipients. It also has two parameters, the only difference is that $receiver has multiple recipients separated with a comma( , ). ``` language <?php // This function will be used to send message to single recipient. function send_message($receiver, $message) { require "config.php"; require './twilio-php/Services/Twilio.php'; $client = new Services_Twilio($sid, $token); $result = $client->account->messages->sendMessage( $my_number, // From a valid Twilio number $receiver, // Text this number $message ); return $result->sid; } // This function will be used to send message to multiple recipient. function send_multiple_message($receiver, $message) { require "config.php"; require './twilio-php/Services/Twilio.php'; $numbers = explode("," , $receiver); $receipt = array(); $count = 0; foreach($numbers AS $num) { $client = new Services_Twilio($sid, $token); $result = $client->account->messages->sendMessage( $my_number, // From a valid Twilio number trim($num), // Text this number $message ); $receipt[$count]["num"] = $num; $receipt[$count]["sid"] = $result->sid; } return $receipt; } ?> ``` **example.php:** This file can send message to a single recipient. HTML Form with $_POST method is used to send data. ``` language <?php require_once("functions.php"); if(isset($_POST['receiver'])) { $receiver = $_POST['receiver']; } if(isset($_POST['message'])) { $message = $_POST['message']; } if(isset($receiver) && isset($message) && !empty($message) && !empty($receiver)) { $result = send_message($receiver,$message); if($result) { echo "<h2>Message Sent....</h2><br />SID Returned By Twillio is: $result"; } } ?> <h1>To send Text Message to multiple recipients <a href="multi.php" >Click Here</a></h1><br /> <div class="box"> <script type="text/javascript"> function submit() { document.getElementById("sendsms").submit(); } </script> <form name="sendsms" id="sendsms" action="" method="post"> Send To:&nbsp;&nbsp;&nbsp;<input name="receiver" type="text" /><br /><br /> Message:&nbsp;&nbsp;<textarea style="width: 400px;height:60px;" name="message" ></textarea><br /> <span style="color: #fff;">Message length:160 characters max..</span><br /> <span ><input class="button" type="button" value="Send SMS..." onclick="submit();" /></span> </form> </div> ``` **integrate.php:** If you want to send message without HTML Form use below code in any desired PHP file. ``` language <?PHP // include function.php file which contains all functions and SDK files require_once("functions.php"); $receiver = "enter number here"; // example +1589658452 $message = "enter message here"; // max character limit 160 if(isset($receiver) && isset($message) && !empty($message) && !empty($receiver)) { //run the function which will send message to recipient using Twilio. $result = send_message($receiver,$message); if($result) { // output the SID received from Twilio echo "<h2>Message Sent....</h2><br />SID Returned By Twilio is: $result"; } } ``` <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/integrate-twilio-sms-service-in-a-website-using-php">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":3242728,"name":"web-php","full_name":"php/web-php","html_url":"https://github.com/php/web-php","fork":false,"owner":{"login":"php"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio","php"]}
parent author
parent permlinkutopian-io
permlinkintegrate-twilio-sms-service-in-a-website-using-php
titleIntegrate Twilio SMS Service in a Website using PHP
Transaction InfoBlock #20640532/Trx c7724beceda66af87010af3aae7624ee53870a5f
View Raw JSON Data
{
  "block": 20640532,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\nNow we are going to learn how to setup and use Twilio for sending text messages to single/multiple recipients.\n\n**Requirements**\nPHP Server\nBasic knowledge about PHP\n\n**Difficulty**\nBasic\n\nMany people want to integrate Short Messaging Service into web applications to send notifications, promotions, reminders to their clients or members from their websites. This can be done using Twilio. Twilio is a cloud communications company that allows developers to programmatically send and receive text messages and make and receive phone calls using its web service APIs. Now we are going to learn how to setup and use Twilio for sending text messages to single/multiple recipients.\n\n![](https://i.hizliresim.com/Z9RrRZ.png)\n\nIn this project I have used The Twilio PHP Helper Library by Twilio. Let’s start with setting up Twilio account first\n\nTwilio Account Setup:\nStep 1: Go for http://twilio.com and Signup for a new Twilio account or Sign in if you already have one.\n\nStep 2: To get started with Twilio you can sign up for a trial account at https://www.twilio.com/try-twilio.\n\nStep 3: Verify your phone number as an outbound caller ID with Twilio. For information on how to verify your phone number, see https://www.twilio.com/user/account/phone-numbers/verified#. For purposes of this example, use the verified phone number as text message recipient in this application.\n\nNote: If you are using a trial account, then its compulsory to use only your own verified phone number for receiving text messages. As an alternative to using an existing number, you can purchase a Twilio phone number.\n\nStep 4: Get account SID and Auth Token from https://www.twilio.com/user/account which will be used in this application.\n\n![](https://i.hizliresim.com/lORo8X.png)\n\nStep 5: Get your Twilio account phone number from https://www.twilio.com/user/account/phone-numbers/incoming which will be used as sender in text messages.\n\n![](https://i.hizliresim.com/G9XqJ2.png)\n\n**PHP Code:**\n\nWe will be working with config.php, example.php, integrate.php and functions.php. Proper understanding of these files is necessary.\n\n**config.php:**\n\n``` language\n<?php\n\n// enter your SID obtained from Twilio account\n$sid = \" your_account_sid \"; \n \n // enter AUTH Token obtained from Twilio\n$token = \" your_authentication_token \";\n\n//Your valid twilio number\n$my_number = \"+12000000000\";\n\n?>\n```\n\n**functions.php:**\n\nThis file has two functions. **send_message** function is used to send message to a single recipient. It has two parameters ($receiver and $message). $receiver contains number to which text message will be sent. $message is body of the message.\n\n**send_multiple_message** function is used to send text messages to multiple recipients. It also has two parameters, the only difference is that $receiver has multiple recipients separated with a comma( , ).\n\n``` language\n<?php\n// This function will be used to send message to single recipient.\nfunction send_message($receiver, $message)\n{\n    require \"config.php\";\n    require './twilio-php/Services/Twilio.php';\n    $client = new Services_Twilio($sid, $token);\n    $result = $client->account->messages->sendMessage(\n      $my_number, // From a valid Twilio number\n      $receiver, // Text this number\n      $message\n    );\n    \n    return $result->sid;  \n    \n}\n\n// This function will be used to send message to multiple recipient.\nfunction send_multiple_message($receiver, $message)\n{\n    require \"config.php\";\n    require './twilio-php/Services/Twilio.php';\n    $numbers  =  explode(\",\" , $receiver);\n    $receipt = array();\n    $count = 0;\n    foreach($numbers AS $num)\n    {\n        \n        $client = new Services_Twilio($sid, $token);\n        $result = $client->account->messages->sendMessage(\n          $my_number, // From a valid Twilio number\n          trim($num), // Text this number\n          $message\n        );\n        \n        $receipt[$count][\"num\"] = $num;\n        $receipt[$count][\"sid\"] = $result->sid;\n        \n    }\n  \n    return $receipt;\n    \n}\n\n?>\n```\n\n**example.php:**\n\nThis file can send message to a single recipient. HTML Form with $_POST method is used to send data.\n\n``` language\n<?php\n\nrequire_once(\"functions.php\");\n\nif(isset($_POST['receiver']))\n{\n    $receiver = $_POST['receiver'];\n}\n\nif(isset($_POST['message']))\n{\n    $message = $_POST['message'];\n}\n\n\n\nif(isset($receiver) && isset($message) && !empty($message) && !empty($receiver))\n{\n  $result = send_message($receiver,$message);\n  if($result)\n  {\n    echo \"<h2>Message Sent....</h2><br />SID Returned By Twillio is: $result\";\n  }\n  \n} \n\n?>\n\n<h1>To send Text Message to multiple recipients <a href=\"multi.php\" >Click Here</a></h1><br />\n\n<div class=\"box\">\n<script type=\"text/javascript\">\nfunction submit()\n{\n    document.getElementById(\"sendsms\").submit();\n}\n</script>\n\n<form name=\"sendsms\" id=\"sendsms\" action=\"\" method=\"post\">\nSend To:&nbsp;&nbsp;&nbsp;<input name=\"receiver\" type=\"text\" /><br /><br />\nMessage:&nbsp;&nbsp;<textarea style=\"width: 400px;height:60px;\" name=\"message\" ></textarea><br />\n<span style=\"color: #fff;\">Message length:160 characters max..</span><br />\n<span ><input class=\"button\" type=\"button\" value=\"Send SMS...\" onclick=\"submit();\" /></span>\n</form>\n</div>\n```\n\n**integrate.php:**\n\nIf you want to send message without HTML Form use below code in any desired PHP file.\n\n``` language\n<?PHP\n// include function.php file which contains all functions and SDK files\nrequire_once(\"functions.php\");\n\n$receiver = \"enter number here\"; // example +1589658452\n$message = \"enter message here\"; // max character limit 160\n\nif(isset($receiver) && isset($message) && !empty($message) && !empty($receiver))\n{\n  //run the function which will send message to recipient using Twilio.\n  $result = send_message($receiver,$message);\n  if($result)\n  {\n    // output the SID received from Twilio\n    echo \"<h2>Message Sent....</h2><br />SID Returned By Twilio is: $result\";\n  }\n  \n}\n```\n\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/integrate-twilio-sms-service-in-a-website-using-php\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":3242728,\"name\":\"web-php\",\"full_name\":\"php/web-php\",\"html_url\":\"https://github.com/php/web-php\",\"fork\":false,\"owner\":{\"login\":\"php\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\",\"php\"]}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "integrate-twilio-sms-service-in-a-website-using-php",
      "title": "Integrate Twilio SMS Service in a Website using PHP"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-13T13:35:21",
  "trx_id": "c7724beceda66af87010af3aae7624ee53870a5f",
  "trx_in_block": 10,
  "virtual_op": 0
}
steemdelegated 14.261 SP to @coderlovely
2018/03/12 22:24:06
delegateecoderlovely
delegatorsteem
vesting shares23189.925757 VESTS
Transaction InfoBlock #20622317/Trx f9bc2cbc3c7aa223cdb7f827181cb069e8c37210
View Raw JSON Data
{
  "block": 20622317,
  "op": [
    "delegate_vesting_shares",
    {
      "delegatee": "coderlovely",
      "delegator": "steem",
      "vesting_shares": "23189.925757 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T22:24:06",
  "trx_id": "f9bc2cbc3c7aa223cdb7f827181cb069e8c37210",
  "trx_in_block": 45,
  "virtual_op": 0
}
coderlovelysent 8.852 SBD to @mrsx7
2018/03/12 21:43:33
amount8.852 SBD
fromcoderlovely
memo
tomrsx7
Transaction InfoBlock #20621506/Trx c72a2f35947a5753275bcb6f982e14df84d6d6a0
View Raw JSON Data
{
  "block": 20621506,
  "op": [
    "transfer",
    {
      "amount": "8.852 SBD",
      "from": "coderlovely",
      "memo": "",
      "to": "mrsx7"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T21:43:33",
  "trx_id": "c72a2f35947a5753275bcb6f982e14df84d6d6a0",
  "trx_in_block": 24,
  "virtual_op": 0
}
coderlovelyclaimed reward balance: 3.627 SBD, 1.842 SP
2018/03/12 21:42:57
accountcoderlovely
reward sbd3.627 SBD
reward steem0.000 STEEM
reward vests2995.285074 VESTS
Transaction InfoBlock #20621494/Trx fa0e62c76c410b2ffb4680f18c0e8f57d1ead5e9
View Raw JSON Data
{
  "block": 20621494,
  "op": [
    "claim_reward_balance",
    {
      "account": "coderlovely",
      "reward_sbd": "3.627 SBD",
      "reward_steem": "0.000 STEEM",
      "reward_vests": "2995.285074 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T21:42:57",
  "trx_id": "fa0e62c76c410b2ffb4680f18c0e8f57d1ead5e9",
  "trx_in_block": 11,
  "virtual_op": 0
}
2018/03/12 21:00:36
authorcoderlovely
permlinkperforming-form-validation-using-validation-asp-net-tutorial
sbd payout3.627 SBD
steem payout0.000 STEEM
vesting payout2995.285074 VESTS
Transaction InfoBlock #20620646/Virtual Operation #18
View Raw JSON Data
{
  "block": 20620646,
  "op": [
    "author_reward",
    {
      "author": "coderlovely",
      "permlink": "performing-form-validation-using-validation-asp-net-tutorial",
      "sbd_payout": "3.627 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "2995.285074 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T21:00:36",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 18
}
utopian.payreceived 1.228 SP benefactor reward from @coderlovely
2018/03/12 21:00:36
authorcoderlovely
benefactorutopian.pay
permlinkperforming-form-validation-using-validation-asp-net-tutorial
sbd payout0.000 SBD
steem payout0.000 STEEM
vesting payout1996.856716 VESTS
Transaction InfoBlock #20620646/Virtual Operation #17
View Raw JSON Data
{
  "block": 20620646,
  "op": [
    "comment_benefactor_reward",
    {
      "author": "coderlovely",
      "benefactor": "utopian.pay",
      "permlink": "performing-form-validation-using-validation-asp-net-tutorial",
      "sbd_payout": "0.000 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "1996.856716 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T21:00:36",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 17
}
coderlovelyclaimed reward balance: 3.671 SBD, 1.865 SP
2018/03/12 20:35:36
accountcoderlovely
reward sbd3.671 SBD
reward steem0.000 STEEM
reward vests3032.098668 VESTS
Transaction InfoBlock #20620147/Trx c1f9d228b9ee4811553fec805b324177343bce35
View Raw JSON Data
{
  "block": 20620147,
  "op": [
    "claim_reward_balance",
    {
      "account": "coderlovely",
      "reward_sbd": "3.671 SBD",
      "reward_steem": "0.000 STEEM",
      "reward_vests": "3032.098668 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T20:35:36",
  "trx_id": "c1f9d228b9ee4811553fec805b324177343bce35",
  "trx_in_block": 31,
  "virtual_op": 0
}
2018/03/12 20:28:54
authorcoderlovely
bodyare you kidding me...give me the right...i will complain you
json metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
parent authordeathwing
parent permlinkre-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t134950922z
permlinkre-deathwing-re-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t202852294z
title
Transaction InfoBlock #20620013/Trx cdc8d9a630114883a804587fb0e67c3d12b737c6
View Raw JSON Data
{
  "block": 20620013,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "are you kidding me...give me the right...i will complain you",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"app\":\"steemit/0.1\"}",
      "parent_author": "deathwing",
      "parent_permlink": "re-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t134950922z",
      "permlink": "re-deathwing-re-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t202852294z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T20:28:54",
  "trx_id": "cdc8d9a630114883a804587fb0e67c3d12b737c6",
  "trx_in_block": 15,
  "virtual_op": 0
}
2018/03/12 15:21:33
authorshreyasgune
bodyThe tutorial is low on content and therefore not been accepted. [utopian moderator]
json metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
parent authorcoderlovely
parent permlinkhow-to-use-usdwatch-angularjs-tutorial
permlinkre-coderlovely-how-to-use-usdwatch-angularjs-tutorial-20180312t152128799z
title
Transaction InfoBlock #20613869/Trx f085b13207f8c5c825527357a97393d1aec2f1af
View Raw JSON Data
{
  "block": 20613869,
  "op": [
    "comment",
    {
      "author": "shreyasgune",
      "body": "The tutorial is low on content and therefore not been accepted.\n\n[utopian moderator]",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"utopian\",\"app\":\"utopian/1.0.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "how-to-use-usdwatch-angularjs-tutorial",
      "permlink": "re-coderlovely-how-to-use-usdwatch-angularjs-tutorial-20180312t152128799z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T15:21:33",
  "trx_id": "f085b13207f8c5c825527357a97393d1aec2f1af",
  "trx_in_block": 32,
  "virtual_op": 0
}
2018/03/12 14:42:00
authorcha0s0000
bodyYour contribution cannot be approved because it is not as informative as other contributions. See the [Utopian Rules](https://utopian.io/rules). Contributions need to be informative and descriptive in order to help readers and developers understand them. - Tutorials must be technical instructions that teach non-trivial aspects of an Open Source project. - One more you should add more code explanation instead of just listing the code You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
json metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
parent authorcoderlovely
parent permlinkhow-to-work-with-input-fields-in-angularjs-angularjs-tutorial
permlinkre-coderlovely-how-to-work-with-input-fields-in-angularjs-angularjs-tutorial-20180312t144158482z
title
Transaction InfoBlock #20613080/Trx 04fe8d3e22ae3b9a6554cfaf86dcfb643d52f185
View Raw JSON Data
{
  "block": 20613080,
  "op": [
    "comment",
    {
      "author": "cha0s0000",
      "body": "Your contribution cannot be approved because it is not as informative as other contributions. See the [Utopian Rules](https://utopian.io/rules). Contributions need to be informative and descriptive in order to help readers and developers understand them.  \n- Tutorials must be technical instructions that teach non-trivial aspects of an Open Source project. \n- One more you should add more code explanation instead of just listing the code \n\nYou can contact us on [Discord](https://discord.gg/uTyJkNm).\n**[[utopian-moderator]](https://utopian.io/moderators)**",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"utopian\",\"app\":\"utopian/1.0.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "how-to-work-with-input-fields-in-angularjs-angularjs-tutorial",
      "permlink": "re-coderlovely-how-to-work-with-input-fields-in-angularjs-angularjs-tutorial-20180312t144158482z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T14:42:00",
  "trx_id": "04fe8d3e22ae3b9a6554cfaf86dcfb643d52f185",
  "trx_in_block": 15,
  "virtual_op": 0
}
2018/03/12 14:39:54
authorcoderlovely
body**What Will I Learn?** A. In this tutorial I would like to show you how to work with input fields in AngularJs B. You will use the ng-model and ng-change directives and the AngularJs watch function $watch C. input fields in AngularJS **Requirements** Basic Knowledge of HTML and CSS language . Basic Knowledge of JavaScript language . Has an editor text support HTML and JavaScript . **Difficulty** Basic In this tutorial I would like to show you how to work with input fields in AngularJs. You will use the ng-model and ng-change directives and the AngularJs watch function $watch. Let’s say we have a form with one input field. If I type in a number the output is multiplied by itself. The form looks like this: **Number: 3 Your number multiplied by itself is: 9** This is the index.html: ``` language <!DOCTYPE html> <html data-ng-app="myApp"> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> <form data-ng-controller="NumberCtrl"> <p>Number: <input data-ng-model="number.value" /></p> <p>Your number multiplied by itself is: {{number.value * number.value}}</p> <form> </body> </html> ``` **This is the app.js:** ``` language var app = angular.module('myApp', []); app.controller('NumberCtrl', function($scope) { $scope.number = { value: 0 }; }); ``` The directive data-ng-model names the property which holds the value of the input field. The property is in the $scope of the controller. Notice that you can also use nested properties like in this case number.value. Each time you type in a number the output gets updated immediately because of the 2-way data-binding. You change something in the GUI (input field) the model will be updated. When the model is updated the GUI will be updated (output). Notice that we have the logic of multiplying our number in the view. Good practice is to move logic to the controller. What we can use here is the data-ng-change directive. Everytime we type in something in the input field we call a function that does the multiplication. The result is stored in a separate property which we output. Here is the changed source code. ``` language <!DOCTYPE html> <html data-ng-app="myApp"> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> <form data-ng-controller="NumberCtrl"> <p>Number: <input data-ng-change="multiplyByItself()" data-ng-model="number.value" /></p> <p>Your number multiplied by itself is: {{number.multipliedByItself}}</p> <form> </body> </html> ``` ``` language var app = angular.module('myApp', []); app.controller('NumberCtrl', function($scope) { $scope.number = { value: 0, multipliedByItself: 0 }; $scope.multiplyByItself = function() { $scope.number.multipliedByItself = $scope.number.value * $scope.number.value; } }); ``` The problem here is that number.multipliedByItself in the output will only be updated when you type in a number in the input field. Only then the multiply function will be executed by data-ng-change. What happens if the property number.value is changed by another controller and not by typing in a number in the input field? number.multipliedByItself won’t be updated because the data-ng-change function will never be called. What we can do here is use AngularJs **$scope.$watch** and get rid of data-ng-change: ``` language <!DOCTYPE html> <html data-ng-app="myApp"> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> <form data-ng-controller="NumberCtrl"> <p>Number: <input data-ng-model="number.value" /></p> <p>Your number multiplied by itself is: {{number.multipliedByItself}}</p> <form> </body> </html> ``` ``` language var app = angular.module('myApp', []); app.controller('NumberCtrl', function($scope) { $scope.number = { value: 0, multipliedByItself: 0 }; var multiplyByItself = function() { $scope.number.multipliedByItself = $scope.number.value * $scope.number.value; } $scope.$watch('number.value', multiplyByItself); }); ``` $scope.$watch takes a string as first argument which represents the property. Everytime the property value changes the second argument which is a function will be called. That means that if you type in something in the input field the property number.value changes so the function multiplyByItself is called which updates the output property. If another controller or anything else changes number.value the output property will also automatically be updated. ![](https://i.hizliresim.com/Md42nk.png) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/how-to-work-with-input-fields-in-angularjs-angularjs-tutorial">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":460078,"name":"angular.js","full_name":"angular/angular.js","html_url":"https://github.com/angular/angular.js","fork":false,"owner":{"login":"angular"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio"],"moderator":{"account":"cha0s0000","time":"2018-03-12T14:39:43.705Z","flagged":true,"reviewed":false,"pending":false},"questions":[],"score":null}
parent author
parent permlinkutopian-io
permlinkhow-to-work-with-input-fields-in-angularjs-angularjs-tutorial
titleHow to work with input fields in AngularJS (angularjs tutorial)
Transaction InfoBlock #20613038/Trx 682f030157b1d3ad01f75c0d2eca29d9e212354a
View Raw JSON Data
{
  "block": 20613038,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\n\nA. In this tutorial I would like to show you how to work with input fields in AngularJs\nB. You will use the ng-model and ng-change directives and the AngularJs watch function $watch\nC. input fields in AngularJS\n\n**Requirements**\n\nBasic Knowledge of HTML and CSS language .\nBasic Knowledge of JavaScript language .\nHas an editor text support HTML and JavaScript .\n\n**Difficulty**\nBasic\n\nIn this tutorial I would like to show you how to work with input fields in AngularJs. You will use the ng-model and ng-change directives and the AngularJs watch function $watch.\n\nLet’s say we have a form with one input field. If I type in a number the output is multiplied by itself. The form looks like this:\n\n**Number: 3\nYour number multiplied by itself is: 9**\n\nThis is the index.html:\n\n``` language\n<!DOCTYPE html>\n<html data-ng-app=\"myApp\">\n  <head>\n    <script type=\"text/javascript\" src=\"angular.min.js\"></script>\n    <script type=\"text/javascript\" src=\"app.js\"></script>\n  </head>\n  <body>\n    <form data-ng-controller=\"NumberCtrl\">\n      <p>Number: <input data-ng-model=\"number.value\" /></p>\n      <p>Your number multiplied by itself is: {{number.value * number.value}}</p>\n    <form>\n  </body>\n</html>\n```\n\n**This is the app.js:**\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('NumberCtrl', function($scope) {\n  $scope.number = {\n    value: 0\n  };\n});\n```\nThe directive data-ng-model names the property which holds the value of the input field. The property is in the $scope of the controller. Notice that you can also use nested properties like in this case number.value.\n\nEach time you type in a number the output gets updated immediately because of the 2-way data-binding. You change something in the GUI (input field) the model will be updated. When the model is updated the GUI will be updated (output).\n\nNotice that we have the logic of multiplying our number in the view. Good practice is to move logic to the controller. What we can use here is the data-ng-change directive. Everytime we type in something in the input field we call a function that does the multiplication. The result is stored in a separate property which we output. Here is the changed source code.\n\n``` language\n<!DOCTYPE html>\n<html data-ng-app=\"myApp\">\n  <head>\n    <script type=\"text/javascript\" src=\"angular.min.js\"></script>\n    <script type=\"text/javascript\" src=\"app.js\"></script>\n  </head>\n  <body>\n    <form data-ng-controller=\"NumberCtrl\">\n      <p>Number: <input data-ng-change=\"multiplyByItself()\" data-ng-model=\"number.value\" /></p>\n      <p>Your number multiplied by itself is: {{number.multipliedByItself}}</p>\n    <form>\n  </body>\n</html>\n```\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('NumberCtrl', function($scope) {\n  $scope.number = {\n    value: 0,\n    multipliedByItself: 0\n  };\n  $scope.multiplyByItself = function() {\n    $scope.number.multipliedByItself = $scope.number.value * $scope.number.value;\n  }\n});\n```\n\nThe problem here is that number.multipliedByItself in the output will only be updated when you type in a number in the input field. Only then the multiply function will be executed by data-ng-change. What happens if the property number.value is changed by another controller and not by typing in a number in the input field? number.multipliedByItself won’t be updated because the data-ng-change function will never be called.\n\nWhat we can do here is use AngularJs **$scope.$watch** and get rid of data-ng-change:\n\n``` language\n<!DOCTYPE html>\n<html data-ng-app=\"myApp\">\n  <head>\n    <script type=\"text/javascript\" src=\"angular.min.js\"></script>\n    <script type=\"text/javascript\" src=\"app.js\"></script>\n  </head>\n  <body>\n    <form data-ng-controller=\"NumberCtrl\">\n      <p>Number: <input data-ng-model=\"number.value\" /></p>\n      <p>Your number multiplied by itself is: {{number.multipliedByItself}}</p>\n    <form>\n  </body>\n</html>\n```\n``` language\nvar app = angular.module('myApp', []);\napp.controller('NumberCtrl', function($scope) {\n  $scope.number = {\n    value: 0,\n    multipliedByItself: 0\n  };\n  var multiplyByItself = function() {\n    $scope.number.multipliedByItself = $scope.number.value * $scope.number.value;\n  }\n  $scope.$watch('number.value', multiplyByItself);\n});\n```\n$scope.$watch takes a string as first argument which represents the property. Everytime the property value changes the second argument which is a function will be called. That means that if you type in something in the input field the property number.value changes so the function multiplyByItself is called which updates the output property. If another controller or anything else changes number.value the output property will also automatically be updated.\n\n![](https://i.hizliresim.com/Md42nk.png)\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/how-to-work-with-input-fields-in-angularjs-angularjs-tutorial\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":460078,\"name\":\"angular.js\",\"full_name\":\"angular/angular.js\",\"html_url\":\"https://github.com/angular/angular.js\",\"fork\":false,\"owner\":{\"login\":\"angular\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\"],\"moderator\":{\"account\":\"cha0s0000\",\"time\":\"2018-03-12T14:39:43.705Z\",\"flagged\":true,\"reviewed\":false,\"pending\":false},\"questions\":[],\"score\":null}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "how-to-work-with-input-fields-in-angularjs-angularjs-tutorial",
      "title": "How to work with input fields in AngularJS (angularjs tutorial)"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T14:39:54",
  "trx_id": "682f030157b1d3ad01f75c0d2eca29d9e212354a",
  "trx_in_block": 47,
  "virtual_op": 0
}
2018/03/12 13:49:57
authordeathwing
bodyYour contribution cannot be approved because it does not follow the [Utopian Rules](https://utopian.io/rules). After secondary review, this tutorial has been rejected due to it being too trivial. You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
json metadata{"tags":["utopian-io"],"community":"busy","app":"busy/2.4.0"}
parent authorcoderlovely
parent permlinkhow-to-repeat-html-elements-in-angularjs
permlinkre-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t134950922z
title
Transaction InfoBlock #20612040/Trx b3128e5bd316c6d3c4a5209083f5f38070eabad1
View Raw JSON Data
{
  "block": 20612040,
  "op": [
    "comment",
    {
      "author": "deathwing",
      "body": "Your contribution cannot be approved because it does not follow the [Utopian Rules](https://utopian.io/rules).\n\nAfter secondary review, this tutorial has been rejected due to it being too trivial.\n\nYou can contact us on [Discord](https://discord.gg/uTyJkNm).\n**[[utopian-moderator]](https://utopian.io/moderators)**",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"busy\",\"app\":\"busy/2.4.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "how-to-repeat-html-elements-in-angularjs",
      "permlink": "re-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t134950922z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T13:49:57",
  "trx_id": "b3128e5bd316c6d3c4a5209083f5f38070eabad1",
  "trx_in_block": 47,
  "virtual_op": 0
}
2018/03/12 13:49:30
authorutopian-io
bodyHey @coderlovely, your contribution was rejected by the supervisor @deathwing because he found out that it did not follow the [Utopian rules](https://utopian.io/rules). Upvote this comment to help Utopian grow its power and help other Open Source contributions like this one. Do you want to chat? Join me on [Discord](https://discord.gg/Pc8HG9x).
json metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
parent authorcoderlovely
parent permlinkhow-to-repeat-html-elements-in-angularjs
permlinkre-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t105221952z
title
Transaction InfoBlock #20612031/Trx 8f1591d13b2f012a35227c96f451b02325da0552
View Raw JSON Data
{
  "block": 20612031,
  "op": [
    "comment",
    {
      "author": "utopian-io",
      "body": "Hey @coderlovely, your contribution was rejected by the supervisor @deathwing because he found out that it did not follow the [Utopian rules](https://utopian.io/rules).\n\nUpvote this comment to help Utopian grow its power and help other Open Source contributions like this one. Do you want to chat? Join me on [Discord](https://discord.gg/Pc8HG9x).",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"utopian\",\"app\":\"utopian/1.0.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "how-to-repeat-html-elements-in-angularjs",
      "permlink": "re-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t105221952z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T13:49:30",
  "trx_id": "8f1591d13b2f012a35227c96f451b02325da0552",
  "trx_in_block": 33,
  "virtual_op": 0
}
2018/03/12 13:49:27
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
voterutopian-io
weight0 (0.00%)
Transaction InfoBlock #20612030/Trx b36148deb75c28edbc62731146b158a1c6b1da58
View Raw JSON Data
{
  "block": 20612030,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "utopian-io",
      "weight": 0
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T13:49:27",
  "trx_id": "b36148deb75c28edbc62731146b158a1c6b1da58",
  "trx_in_block": 14,
  "virtual_op": 0
}
2018/03/12 13:49:12
authorcoderlovely
body**What Will I Learn?** A.How to repeat HTML elements in AngularJS B.We want to display all tracks with the duration as a bulleted list C.Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list **Requirements** Basic Knowledge of HTML and CSS language . Basic Knowledge of JavaScript language . Has an editor text support HTML and JavaScript . **Difficulty** Basic In this tutorial I would like to show you how to repeat HTML elements in AngularJs. So let’s assume we have a list of album tracks. We want to display all tracks with the duration as a bulleted list. Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list: Coldplay 1. Paradise 4:21 (first track) 2. Princes of China 3:35 (middle track) 3. The Scientist 4:26 (middle track) 4. Atlas 3:22 (last track) **Here’s the source code:** ``` language <!DOCTYPE html> <html data-ng-app="myApp"> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> <ul data-ng-controller="AlbumCtrl"> <li data-ng-repeat="track in tracks"> {{$index + 1}}. {{track.name}} {{track.duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track) </li> </ul> </body> </html> ``` ``` language var app = angular.module('myApp', []); app.controller('AlbumCtrl', function($scope) { $scope.tracks = [ {name:'Paradise', duration:'4:21'}, {name:'Princess of China', duration:'3:35'}, {name:'The Scientist', duration:'4:26'}, {name:'Atlas', duration:'3:22'} ]; }); ``` As you can see you can use the data-ng-repeat attribute directive to loop over a collection in the model (tracks) and repeat the < li > element. Inside the loop you can use implicit properties llike $index, $first, $middle and $last which give you the current loop index (starts at 0) and booleans if the element is the first, in the middle or the last in the list respectively. The cool thing is that you not only can loop over a list but also the key-value pairs in an object. So let’s say the album tracks are stored in a JavaScript object: ``` language <h3>Coldplay</h3> <ul data-ng-controller="AlbumCtrl"> <li data-ng-repeat="(name, duration) in tracks"> {{$index + 1}}. {{name}} {{duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track) </li> </ul> ``` ``` language var app = angular.module('myApp', []); app.controller('AlbumCtrl', function($scope) { $scope.tracks = { 'Paradise' : '4:21', 'Princess of China' : '3:35', 'The Scientist' : '4:26', 'Atlas' : '3:22' } }); ``` - As you can see tracks is now a JavaScript object/dictionary. - The notation at data-ng-repeat changed to (name, duration) which represent a key-value pair in tracks. - The downside is that the order of the key-value pairs is not kept as appearing in tracks. AngularJs automatically sorts the keys alphabetically. ![](https://i.hizliresim.com/Md4pm6.png) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/how-to-repeat-html-elements-in-angularjs">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":460078,"name":"angular.js","full_name":"angular/angular.js","html_url":"https://github.com/angular/angular.js","fork":false,"owner":{"login":"angular"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio"],"moderator":{"account":"deathwing","time":"2018-03-12T13:49:11.185Z","reviewed":false,"pending":false,"flagged":true},"questions":[],"score":51}
parent author
parent permlinkutopian-io
permlinkhow-to-repeat-html-elements-in-angularjs
titleHow to repeat HTML elements in AngularJS
Transaction InfoBlock #20612025/Trx d71ed2a6b4481976814888051cfb7aba4016c214
View Raw JSON Data
{
  "block": 20612025,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\n\nA.How to repeat HTML elements in AngularJS\nB.We want to display all tracks with the duration as a bulleted list\nC.Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list\n\n**Requirements**\n\nBasic Knowledge of HTML and CSS language .\nBasic Knowledge of JavaScript language .\nHas an editor text support HTML and JavaScript .\n\n**Difficulty**\nBasic\n\nIn this tutorial I would like to show you how to repeat HTML elements in AngularJs. So let’s assume we have a list of album tracks. We want to display all tracks with the duration as a bulleted list. Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list:\n\nColdplay\n\n1. Paradise 4:21 (first track)\n2. Princes of China 3:35 (middle track)\n3. The Scientist 4:26 (middle track)\n4. Atlas 3:22 (last track)\n\n**Here’s the source code:**\n\n``` language\n<!DOCTYPE html>\n<html data-ng-app=\"myApp\">\n  <head>\n    <script type=\"text/javascript\" src=\"angular.min.js\"></script>\n    <script type=\"text/javascript\" src=\"app.js\"></script>\n  </head>\n  <body>\n    <ul data-ng-controller=\"AlbumCtrl\">\n      <li data-ng-repeat=\"track in tracks\">\n        {{$index + 1}}. {{track.name}} {{track.duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track)\n      </li>\n    </ul>\n  </body>\n</html>\n\n```\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('AlbumCtrl', function($scope) {\n    $scope.tracks = [\n        {name:'Paradise', duration:'4:21'},\n        {name:'Princess of China', duration:'3:35'},\n        {name:'The Scientist', duration:'4:26'},\n        {name:'Atlas', duration:'3:22'}\n    ];\n});\n```\nAs you can see you can use the data-ng-repeat attribute directive to loop over a collection in the model (tracks) and repeat the < li > element.\n\nInside the loop you can use implicit properties llike $index, $first, $middle and $last which give you the current loop index (starts at 0) and booleans if the element is the first, in the middle or the last in the list respectively.\n\nThe cool thing is that you not only can loop over a list but also the key-value pairs in an object. So let’s say the album tracks are stored in a JavaScript object:\n\n``` language\n<h3>Coldplay</h3>\n<ul data-ng-controller=\"AlbumCtrl\">\n    <li data-ng-repeat=\"(name, duration) in tracks\">\n        {{$index + 1}}. {{name}} {{duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track)\n    </li>\n</ul>\n```\n``` language\nvar app = angular.module('myApp', []);\napp.controller('AlbumCtrl', function($scope) {\n    $scope.tracks = {\n        'Paradise' : '4:21',\n        'Princess of China' : '3:35',\n        'The Scientist' : '4:26',\n        'Atlas' : '3:22'\n    }\n});\n```\n- As you can see tracks is now a JavaScript object/dictionary.\n- The notation at data-ng-repeat changed to (name, duration) which represent a key-value pair in \n   tracks.\n- The downside is that the order of the key-value pairs is not kept as appearing in tracks. AngularJs automatically sorts the keys alphabetically.\n\n![](https://i.hizliresim.com/Md4pm6.png)\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/how-to-repeat-html-elements-in-angularjs\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":460078,\"name\":\"angular.js\",\"full_name\":\"angular/angular.js\",\"html_url\":\"https://github.com/angular/angular.js\",\"fork\":false,\"owner\":{\"login\":\"angular\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\"],\"moderator\":{\"account\":\"deathwing\",\"time\":\"2018-03-12T13:49:11.185Z\",\"reviewed\":false,\"pending\":false,\"flagged\":true},\"questions\":[],\"score\":51}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "title": "How to repeat HTML elements in AngularJS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T13:49:12",
  "trx_id": "d71ed2a6b4481976814888051cfb7aba4016c214",
  "trx_in_block": 12,
  "virtual_op": 0
}
2018/03/12 13:20:30
authorcoderlovely
permlinkhow-to-work-with-input-fields-in-angularjs-angularjs-tutorial
votermarketstack
weight425 (4.25%)
Transaction InfoBlock #20611451/Trx d3853b2405e9db6508676ff8e6d005364359588e
View Raw JSON Data
{
  "block": 20611451,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-work-with-input-fields-in-angularjs-angularjs-tutorial",
      "voter": "marketstack",
      "weight": 425
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T13:20:30",
  "trx_id": "d3853b2405e9db6508676ff8e6d005364359588e",
  "trx_in_block": 35,
  "virtual_op": 0
}
2018/03/12 12:49:39
allow curation rewardstrue
allow votestrue
authorcoderlovely
extensions[[0,{"beneficiaries":[{"account":"utopian.pay","weight":2500}]}]]
max accepted payout1000000.000 SBD
percent steem dollars10000
permlinkhow-to-work-with-input-fields-in-angularjs-angularjs-tutorial
Transaction InfoBlock #20610835/Trx 86797b9157ae8972dc0986ea8867f58bf350a76b
View Raw JSON Data
{
  "block": 20610835,
  "op": [
    "comment_options",
    {
      "allow_curation_rewards": true,
      "allow_votes": true,
      "author": "coderlovely",
      "extensions": [
        [
          0,
          {
            "beneficiaries": [
              {
                "account": "utopian.pay",
                "weight": 2500
              }
            ]
          }
        ]
      ],
      "max_accepted_payout": "1000000.000 SBD",
      "percent_steem_dollars": 10000,
      "permlink": "how-to-work-with-input-fields-in-angularjs-angularjs-tutorial"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T12:49:39",
  "trx_id": "86797b9157ae8972dc0986ea8867f58bf350a76b",
  "trx_in_block": 87,
  "virtual_op": 0
}
2018/03/12 12:49:39
authorcoderlovely
body**What Will I Learn?** A. In this tutorial I would like to show you how to work with input fields in AngularJs B. You will use the ng-model and ng-change directives and the AngularJs watch function $watch C. input fields in AngularJS **Requirements** Basic Knowledge of HTML and CSS language . Basic Knowledge of JavaScript language . Has an editor text support HTML and JavaScript . **Difficulty** Basic In this tutorial I would like to show you how to work with input fields in AngularJs. You will use the ng-model and ng-change directives and the AngularJs watch function $watch. Let’s say we have a form with one input field. If I type in a number the output is multiplied by itself. The form looks like this: **Number: 3 Your number multiplied by itself is: 9** This is the index.html: ``` language <!DOCTYPE html> <html data-ng-app="myApp"> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> <form data-ng-controller="NumberCtrl"> <p>Number: <input data-ng-model="number.value" /></p> <p>Your number multiplied by itself is: {{number.value * number.value}}</p> <form> </body> </html> ``` **This is the app.js:** ``` language var app = angular.module('myApp', []); app.controller('NumberCtrl', function($scope) { $scope.number = { value: 0 }; }); ``` The directive data-ng-model names the property which holds the value of the input field. The property is in the $scope of the controller. Notice that you can also use nested properties like in this case number.value. Each time you type in a number the output gets updated immediately because of the 2-way data-binding. You change something in the GUI (input field) the model will be updated. When the model is updated the GUI will be updated (output). Notice that we have the logic of multiplying our number in the view. Good practice is to move logic to the controller. What we can use here is the data-ng-change directive. Everytime we type in something in the input field we call a function that does the multiplication. The result is stored in a separate property which we output. Here is the changed source code. ``` language <!DOCTYPE html> <html data-ng-app="myApp"> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> <form data-ng-controller="NumberCtrl"> <p>Number: <input data-ng-change="multiplyByItself()" data-ng-model="number.value" /></p> <p>Your number multiplied by itself is: {{number.multipliedByItself}}</p> <form> </body> </html> ``` ``` language var app = angular.module('myApp', []); app.controller('NumberCtrl', function($scope) { $scope.number = { value: 0, multipliedByItself: 0 }; $scope.multiplyByItself = function() { $scope.number.multipliedByItself = $scope.number.value * $scope.number.value; } }); ``` The problem here is that number.multipliedByItself in the output will only be updated when you type in a number in the input field. Only then the multiply function will be executed by data-ng-change. What happens if the property number.value is changed by another controller and not by typing in a number in the input field? number.multipliedByItself won’t be updated because the data-ng-change function will never be called. What we can do here is use AngularJs **$scope.$watch** and get rid of data-ng-change: ``` language <!DOCTYPE html> <html data-ng-app="myApp"> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> <form data-ng-controller="NumberCtrl"> <p>Number: <input data-ng-model="number.value" /></p> <p>Your number multiplied by itself is: {{number.multipliedByItself}}</p> <form> </body> </html> ``` ``` language var app = angular.module('myApp', []); app.controller('NumberCtrl', function($scope) { $scope.number = { value: 0, multipliedByItself: 0 }; var multiplyByItself = function() { $scope.number.multipliedByItself = $scope.number.value * $scope.number.value; } $scope.$watch('number.value', multiplyByItself); }); ``` $scope.$watch takes a string as first argument which represents the property. Everytime the property value changes the second argument which is a function will be called. That means that if you type in something in the input field the property number.value changes so the function multiplyByItself is called which updates the output property. If another controller or anything else changes number.value the output property will also automatically be updated. ![](https://i.hizliresim.com/Md42nk.png) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/how-to-work-with-input-fields-in-angularjs-angularjs-tutorial">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":460078,"name":"angular.js","full_name":"angular/angular.js","html_url":"https://github.com/angular/angular.js","fork":false,"owner":{"login":"angular"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio"]}
parent author
parent permlinkutopian-io
permlinkhow-to-work-with-input-fields-in-angularjs-angularjs-tutorial
titleHow to work with input fields in AngularJS (angularjs tutorial)
Transaction InfoBlock #20610835/Trx 86797b9157ae8972dc0986ea8867f58bf350a76b
View Raw JSON Data
{
  "block": 20610835,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\n\nA. In this tutorial I would like to show you how to work with input fields in AngularJs\nB. You will use the ng-model and ng-change directives and the AngularJs watch function $watch\nC. input fields in AngularJS\n\n**Requirements**\n\nBasic Knowledge of HTML and CSS language .\nBasic Knowledge of JavaScript language .\nHas an editor text support HTML and JavaScript .\n\n**Difficulty**\nBasic\n\nIn this tutorial I would like to show you how to work with input fields in AngularJs. You will use the ng-model and ng-change directives and the AngularJs watch function $watch.\n\nLet’s say we have a form with one input field. If I type in a number the output is multiplied by itself. The form looks like this:\n\n**Number: 3\nYour number multiplied by itself is: 9**\n\nThis is the index.html:\n\n``` language\n<!DOCTYPE html>\n<html data-ng-app=\"myApp\">\n  <head>\n    <script type=\"text/javascript\" src=\"angular.min.js\"></script>\n    <script type=\"text/javascript\" src=\"app.js\"></script>\n  </head>\n  <body>\n    <form data-ng-controller=\"NumberCtrl\">\n      <p>Number: <input data-ng-model=\"number.value\" /></p>\n      <p>Your number multiplied by itself is: {{number.value * number.value}}</p>\n    <form>\n  </body>\n</html>\n```\n\n**This is the app.js:**\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('NumberCtrl', function($scope) {\n  $scope.number = {\n    value: 0\n  };\n});\n```\nThe directive data-ng-model names the property which holds the value of the input field. The property is in the $scope of the controller. Notice that you can also use nested properties like in this case number.value.\n\nEach time you type in a number the output gets updated immediately because of the 2-way data-binding. You change something in the GUI (input field) the model will be updated. When the model is updated the GUI will be updated (output).\n\nNotice that we have the logic of multiplying our number in the view. Good practice is to move logic to the controller. What we can use here is the data-ng-change directive. Everytime we type in something in the input field we call a function that does the multiplication. The result is stored in a separate property which we output. Here is the changed source code.\n\n``` language\n<!DOCTYPE html>\n<html data-ng-app=\"myApp\">\n  <head>\n    <script type=\"text/javascript\" src=\"angular.min.js\"></script>\n    <script type=\"text/javascript\" src=\"app.js\"></script>\n  </head>\n  <body>\n    <form data-ng-controller=\"NumberCtrl\">\n      <p>Number: <input data-ng-change=\"multiplyByItself()\" data-ng-model=\"number.value\" /></p>\n      <p>Your number multiplied by itself is: {{number.multipliedByItself}}</p>\n    <form>\n  </body>\n</html>\n```\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('NumberCtrl', function($scope) {\n  $scope.number = {\n    value: 0,\n    multipliedByItself: 0\n  };\n  $scope.multiplyByItself = function() {\n    $scope.number.multipliedByItself = $scope.number.value * $scope.number.value;\n  }\n});\n```\n\nThe problem here is that number.multipliedByItself in the output will only be updated when you type in a number in the input field. Only then the multiply function will be executed by data-ng-change. What happens if the property number.value is changed by another controller and not by typing in a number in the input field? number.multipliedByItself won’t be updated because the data-ng-change function will never be called.\n\nWhat we can do here is use AngularJs **$scope.$watch** and get rid of data-ng-change:\n\n``` language\n<!DOCTYPE html>\n<html data-ng-app=\"myApp\">\n  <head>\n    <script type=\"text/javascript\" src=\"angular.min.js\"></script>\n    <script type=\"text/javascript\" src=\"app.js\"></script>\n  </head>\n  <body>\n    <form data-ng-controller=\"NumberCtrl\">\n      <p>Number: <input data-ng-model=\"number.value\" /></p>\n      <p>Your number multiplied by itself is: {{number.multipliedByItself}}</p>\n    <form>\n  </body>\n</html>\n```\n``` language\nvar app = angular.module('myApp', []);\napp.controller('NumberCtrl', function($scope) {\n  $scope.number = {\n    value: 0,\n    multipliedByItself: 0\n  };\n  var multiplyByItself = function() {\n    $scope.number.multipliedByItself = $scope.number.value * $scope.number.value;\n  }\n  $scope.$watch('number.value', multiplyByItself);\n});\n```\n$scope.$watch takes a string as first argument which represents the property. Everytime the property value changes the second argument which is a function will be called. That means that if you type in something in the input field the property number.value changes so the function multiplyByItself is called which updates the output property. If another controller or anything else changes number.value the output property will also automatically be updated.\n\n![](https://i.hizliresim.com/Md42nk.png)\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/how-to-work-with-input-fields-in-angularjs-angularjs-tutorial\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":460078,\"name\":\"angular.js\",\"full_name\":\"angular/angular.js\",\"html_url\":\"https://github.com/angular/angular.js\",\"fork\":false,\"owner\":{\"login\":\"angular\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\"]}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "how-to-work-with-input-fields-in-angularjs-angularjs-tutorial",
      "title": "How to work with input fields in AngularJS (angularjs tutorial)"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T12:49:39",
  "trx_id": "86797b9157ae8972dc0986ea8867f58bf350a76b",
  "trx_in_block": 87,
  "virtual_op": 0
}
2018/03/12 11:48:24
authorcoderlovely
permlinkworking-with-html-controls-web-server-controls-asp-net-tutorial
sbd payout3.657 SBD
steem payout0.000 STEEM
vesting payout3019.847355 VESTS
Transaction InfoBlock #20609611/Virtual Operation #13
View Raw JSON Data
{
  "block": 20609611,
  "op": [
    "author_reward",
    {
      "author": "coderlovely",
      "permlink": "working-with-html-controls-web-server-controls-asp-net-tutorial",
      "sbd_payout": "3.657 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "3019.847355 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T11:48:24",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 13
}
utopian.payreceived 1.237 SP benefactor reward from @coderlovely
2018/03/12 11:48:24
authorcoderlovely
benefactorutopian.pay
permlinkworking-with-html-controls-web-server-controls-asp-net-tutorial
sbd payout0.000 SBD
steem payout0.000 STEEM
vesting payout2011.189753 VESTS
Transaction InfoBlock #20609611/Virtual Operation #12
View Raw JSON Data
{
  "block": 20609611,
  "op": [
    "comment_benefactor_reward",
    {
      "author": "coderlovely",
      "benefactor": "utopian.pay",
      "permlink": "working-with-html-controls-web-server-controls-asp-net-tutorial",
      "sbd_payout": "0.000 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "2011.189753 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T11:48:24",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 12
}
2018/03/12 10:52:21
authorutopian-io
body### Hey @coderlovely I am @utopian-io. I have just upvoted you! #### Achievements - You have less than 500 followers. Just gave you a gift to help you succeed! - Seems like you contribute quite often. AMAZING! #### Suggestions - Contribute more often to get higher and higher rewards. I wish to see you often! - Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck! #### Get Noticed! - Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions! #### Community-Driven Witness! I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER! - <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a> - <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a> - Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a> [![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](https://steemit.com/~witnesses) **Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
json metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
parent authorcoderlovely
parent permlinkhow-to-repeat-html-elements-in-angularjs
permlinkre-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t105221952z
title
Transaction InfoBlock #20608492/Trx de09dbeacb1f04815666f8dc1ec76a549c0d23bb
View Raw JSON Data
{
  "block": 20608492,
  "op": [
    "comment",
    {
      "author": "utopian-io",
      "body": "### Hey @coderlovely I am @utopian-io. I have just upvoted you!\n#### Achievements\n- You have less than 500 followers. Just gave you a gift to help you succeed!\n- Seems like you contribute quite often. AMAZING!\n#### Suggestions\n- Contribute more often to get higher and higher rewards. I wish to see you often!\n- Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!\n#### Get Noticed!\n- Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!\n#### Community-Driven Witness!\nI am the first and only Steem Community-Driven Witness. <a href=\"https://discord.gg/zTrEMqB\">Participate on Discord</a>. Lets GROW TOGETHER!\n- <a href=\"https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1\">Vote for my Witness With SteemConnect</a>\n- <a href=\"https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1\">Proxy vote to Utopian Witness with SteemConnect</a>\n- Or vote/proxy on <a href=\"https://steemit.com/~witnesses\">Steemit Witnesses</a>\n\n[![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](https://steemit.com/~witnesses)\n\n**Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"utopian\",\"app\":\"utopian/1.0.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "how-to-repeat-html-elements-in-angularjs",
      "permlink": "re-coderlovely-how-to-repeat-html-elements-in-angularjs-20180312t105221952z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T10:52:21",
  "trx_id": "de09dbeacb1f04815666f8dc1ec76a549c0d23bb",
  "trx_in_block": 51,
  "virtual_op": 0
}
2018/03/12 10:52:18
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
voterutopian-io
weight702 (7.02%)
Transaction InfoBlock #20608491/Trx b5cfba8daec850437b03a33a4cbd7d1ec5ba59c2
View Raw JSON Data
{
  "block": 20608491,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "utopian-io",
      "weight": 702
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T10:52:18",
  "trx_id": "b5cfba8daec850437b03a33a4cbd7d1ec5ba59c2",
  "trx_in_block": 53,
  "virtual_op": 0
}
2018/03/12 10:18:00
authorcoderlovely
body**What Will I Learn?** A. In this tutorial I would like to talk about the $watch function and what you can do with it. B. what is watchFn C.what is watchAction **Requirements** Basic Knowledge of HTML and CSS language . Basic Knowledge of JavaScript language . Has an editor text support HTML and JavaScript . **Difficulty** Basic **$watch(watchFn, watchAction, isDeepWatch)** **watchFn:** Is a string or a function. If you want to observe a $scope property when it changes you have to provide a string, e.g. $watch(‘counter’, …). If you want to observe the return value of a function for changes you have to provide the function, e.g. $watch($scope.getCount, …). **watchAction:** A function to be executed if there are changes in the observed model. The function gets the new value, the old value and the scope as parameters, e.g. function watchAction(newValue, oldValue, scope). **isDeepWatch:** Is a boolean which is set to true, if you watch an array or an object. If you observe an array or object usually you want to know if an element of the array or a property of the object has changed. So if this boolean is set to true the whole array or object is traversed and checked for changes. Beware this could be time consuming if this is a large array or object. **Example for watching a property:** Let’ take the program from 2 ways to set a model value in the view. Each time you click on the button the counter will be increased. I want the button to be disabled when the number reached 10. I can do this by watching the corresponding property: ``` language <div data-ng-controller="CounterCtrl"> <button data-ng-click="increaseCounter()" data-ng-disabled="maxNumberReached">Click to increase counter</button> <div>Counter: {{counter}}</div> </div> ``` ``` language var app = angular.module('myApp', []); app.controller('CounterCtrl', function($scope) { $scope.maxNumberReached = false; $scope.counter = 0; $scope.increaseCounter = function() { $scope.counter++; }; $scope.$watch('counter', function(newValue, oldValue, scope) { if (newValue >= 10) { $scope.maxNumberReached = true; } }); }); ``` **Example for watching a function:** ``` language <div data-ng-controller="CounterCtrl"> <button data-ng-click="increaseCounter()" data-ng-disabled="maxNumberReached">Click to increase counter</button> <div>Counter: {{getCounter()}}</div> </div> ``` ``` language var app = angular.module('myApp', []); app.controller('CounterCtrl', function($scope) { $scope.maxNumberReached = false; $scope.counter = 0; $scope.increaseCounter = function() { $scope.counter++; }; $scope.getCounter = function() { return $scope.counter; }; $scope.$watch($scope.getCounter, function(newValue, oldValue, scope) { if (newValue >= 10) { $scope.maxNumberReached = true; } }); }); ``` **Example for a watcher with watchFn only:** This is a possibility not known by many. There are times when it makes sense to use this version because of performance issues. Imagine you need to watch a large object or array. This can lead to performance problems because each time the page is evaluated AngularJS has to go through the array or object again to check if there is a change. It could be cheaper to manually check the differences in the observed array or object if you exactly know what you want to check. In this case just provide a watchFn function that is called each time the page is evaluated by AngularJS. ``` language <div data-ng-controller="MyCtrl"> <input type="text" data-ng-model="text" data-ng-change="addText()" /> <p>Size of the text array: {{textArrSize}}</p> </div> ``` ``` language var app = angular.module('myApp', []); app.controller('MyCtrl', function($scope) { $scope.text = ''; $scope.textArr = []; $scope.addText = function() { $scope.textArr.push($scope.text); }; $scope.$watch(function() { $scope.textArrSize = $scope.textArr.length; }); }); ``` In the example above each time you type in something in the input field the string is added to an array. The array gets larger and larger. If we had a watcher for this array it could lead to performance issues once the array is too large. So in this case instead of comparing the array for changes only a function is called each time the page is evaluated by AngularJS. The page is evaluated whenever I type in something in the input field. ![](https://i.hizliresim.com/5Dzald.png) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/how-to-use-usdwatch-angularjs-tutorial">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":460078,"name":"angular.js","full_name":"angular/angular.js","html_url":"https://github.com/angular/angular.js","fork":false,"owner":{"login":"angular"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio"],"moderator":{"account":"shreyasgune","time":"2018-03-12T10:17:49.619Z","flagged":true,"reviewed":false,"pending":false},"questions":[],"score":null}
parent author
parent permlinkutopian-io
permlinkhow-to-use-usdwatch-angularjs-tutorial
titleHow to use $watch (angularjs tutorial)
Transaction InfoBlock #20607806/Trx 54e404e09642fe613fbb0b37a595d35119ca13c2
View Raw JSON Data
{
  "block": 20607806,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\n\nA. In this tutorial I would like to talk about the $watch function and what you can do with it.\nB. what is watchFn\nC.what is watchAction\n\n**Requirements**\n\nBasic Knowledge of HTML and CSS language .\nBasic Knowledge of JavaScript language .\nHas an editor text support HTML and JavaScript .\n\n**Difficulty**\nBasic\n\n**$watch(watchFn, watchAction, isDeepWatch)**\n\n**watchFn:**\n\nIs a string or a function. If you want to observe a $scope property when it changes you have to provide a string, e.g. $watch(‘counter’, …). If you want to observe the return value of a function for changes you have to provide the function, e.g. $watch($scope.getCount, …).\n\n**watchAction:**\n\nA function to be executed if there are changes in the observed model. The function gets the new value, the old value and the scope as parameters, e.g. function watchAction(newValue, oldValue, scope).\n\n**isDeepWatch:**\n\nIs a boolean which is set to true, if you watch an array or an object. If you observe an array or object usually you want to know if an element of the array or a property of the object has changed. So if this boolean is set to true the whole array or object is traversed and checked for changes. Beware this could be time consuming if this is a large array or object.\n\n**Example for watching a property:**\n\nLet’ take the program from 2 ways to set a model value in the view. Each time you click on the button the counter will be increased. I want the button to be disabled when the number reached 10. I can do this by watching the corresponding property:\n\n``` language\n<div data-ng-controller=\"CounterCtrl\">\n    <button data-ng-click=\"increaseCounter()\" data-ng-disabled=\"maxNumberReached\">Click to increase counter</button>\n    <div>Counter: {{counter}}</div>\n</div>\n```\n``` language\nvar app = angular.module('myApp', []);\napp.controller('CounterCtrl', function($scope) {\n    $scope.maxNumberReached = false;\n    $scope.counter = 0;\n    $scope.increaseCounter = function() {\n        $scope.counter++;\n    };\n    $scope.$watch('counter', function(newValue, oldValue, scope) {\n        if (newValue >= 10) {\n            $scope.maxNumberReached = true;\n        }\n    });\n});\n```\n**Example for watching a function:**\n\n``` language\n<div data-ng-controller=\"CounterCtrl\">\n    <button data-ng-click=\"increaseCounter()\" data-ng-disabled=\"maxNumberReached\">Click to increase counter</button>\n    <div>Counter: {{getCounter()}}</div>\n</div>\n```\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('CounterCtrl', function($scope) {\n    $scope.maxNumberReached = false;\n    $scope.counter = 0;\n    $scope.increaseCounter = function() {\n        $scope.counter++;\n    };\n    $scope.getCounter = function() {\n        return $scope.counter;\n    };\n    $scope.$watch($scope.getCounter, function(newValue, oldValue, scope) {\n        if (newValue >= 10) {\n            $scope.maxNumberReached = true;\n        }\n    });\n});\n```\n\n**Example for a watcher with watchFn only:**\nThis is a possibility not known by many. There are times when it makes sense to use this version because of performance issues.\n\nImagine you need to watch a large object or array. This can lead to performance problems because each time the page is evaluated AngularJS has to go through the array or object again to check if there is a change. It could be cheaper to manually check the differences in the observed array or object if you exactly know what you want to check.\n\nIn this case just provide a watchFn function that is called each time the page is evaluated by AngularJS.\n\n``` language\n<div data-ng-controller=\"MyCtrl\">\n    <input type=\"text\" data-ng-model=\"text\" data-ng-change=\"addText()\" />\n    <p>Size of the text array: {{textArrSize}}</p>\n</div>\n```\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('MyCtrl', function($scope) {\n    $scope.text = '';\n    $scope.textArr = [];\n    $scope.addText = function() {\n        $scope.textArr.push($scope.text);\n    };\n    $scope.$watch(function() {\n        $scope.textArrSize = $scope.textArr.length;\n    });\n});\n```\n\nIn the example above each time you type in something in the input field the string is added to an array. The array gets larger and larger. If we had a watcher for this array it could lead to performance issues once the array is too large. So in this case instead of comparing the array for changes only a function is called each time the page is evaluated by AngularJS. The page is evaluated whenever I type in something in the input field.\n\n![](https://i.hizliresim.com/5Dzald.png)\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/how-to-use-usdwatch-angularjs-tutorial\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":460078,\"name\":\"angular.js\",\"full_name\":\"angular/angular.js\",\"html_url\":\"https://github.com/angular/angular.js\",\"fork\":false,\"owner\":{\"login\":\"angular\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\"],\"moderator\":{\"account\":\"shreyasgune\",\"time\":\"2018-03-12T10:17:49.619Z\",\"flagged\":true,\"reviewed\":false,\"pending\":false},\"questions\":[],\"score\":null}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "how-to-use-usdwatch-angularjs-tutorial",
      "title": "How to use $watch (angularjs tutorial)"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T10:18:00",
  "trx_id": "54e404e09642fe613fbb0b37a595d35119ca13c2",
  "trx_in_block": 40,
  "virtual_op": 0
}
2018/03/12 09:42:27
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
voterfaisalali734
weight10000 (100.00%)
Transaction InfoBlock #20607096/Trx 3d782e988c938bbda44869778363424615627e18
View Raw JSON Data
{
  "block": 20607096,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "faisalali734",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T09:42:27",
  "trx_id": "3d782e988c938bbda44869778363424615627e18",
  "trx_in_block": 30,
  "virtual_op": 0
}
2018/03/12 09:33:30
authorcoderlovely
permlinkhow-to-use-usdwatch-angularjs-tutorial
voterlidstearch
weight10000 (100.00%)
Transaction InfoBlock #20606918/Trx 641055dfb7e52ed67828a368afdea94e54d37084
View Raw JSON Data
{
  "block": 20606918,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-use-usdwatch-angularjs-tutorial",
      "voter": "lidstearch",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T09:33:30",
  "trx_id": "641055dfb7e52ed67828a368afdea94e54d37084",
  "trx_in_block": 0,
  "virtual_op": 0
}
2018/03/12 08:37:36
authorcoderlovely
permlinkhow-to-use-usdwatch-angularjs-tutorial
votersjennon
weight1500 (15.00%)
Transaction InfoBlock #20605801/Trx 207dd39254f6beb311b8ce988b320fb4cb297837
View Raw JSON Data
{
  "block": 20605801,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-use-usdwatch-angularjs-tutorial",
      "voter": "sjennon",
      "weight": 1500
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T08:37:36",
  "trx_id": "207dd39254f6beb311b8ce988b320fb4cb297837",
  "trx_in_block": 50,
  "virtual_op": 0
}
2018/03/12 06:34:45
authorcoderlovely
permlinkhow-to-use-usdwatch-angularjs-tutorial
voterkrishatnet
weight10000 (100.00%)
Transaction InfoBlock #20603347/Trx 3472f7ac8754c7468c669d1d4d3f411866aa52bd
View Raw JSON Data
{
  "block": 20603347,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-use-usdwatch-angularjs-tutorial",
      "voter": "krishatnet",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T06:34:45",
  "trx_id": "3472f7ac8754c7468c669d1d4d3f411866aa52bd",
  "trx_in_block": 26,
  "virtual_op": 0
}
2018/03/12 05:54:45
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
voterjosephace135
weight10000 (100.00%)
Transaction InfoBlock #20602547/Trx 3fd7ef02bab0a3f96ba5ed36d0b428de3db87983
View Raw JSON Data
{
  "block": 20602547,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "josephace135",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-12T05:54:45",
  "trx_id": "3fd7ef02bab0a3f96ba5ed36d0b428de3db87983",
  "trx_in_block": 21,
  "virtual_op": 0
}
2018/03/11 23:48:42
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
votergreenorange
weight10000 (100.00%)
Transaction InfoBlock #20595236/Trx 1ace56de09de36aa09706cd6e02e7b47ad54c099
View Raw JSON Data
{
  "block": 20595236,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "greenorange",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T23:48:42",
  "trx_id": "1ace56de09de36aa09706cd6e02e7b47ad54c099",
  "trx_in_block": 19,
  "virtual_op": 0
}
2018/03/11 23:48:42
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
voterloshcat
weight10000 (100.00%)
Transaction InfoBlock #20595236/Trx e5e8bb1f3c5d2c5b316a5aebcf2571d84c71e803
View Raw JSON Data
{
  "block": 20595236,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "loshcat",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T23:48:42",
  "trx_id": "e5e8bb1f3c5d2c5b316a5aebcf2571d84c71e803",
  "trx_in_block": 18,
  "virtual_op": 0
}
2018/03/11 23:38:03
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
voterderasmo
weight10000 (100.00%)
Transaction InfoBlock #20595024/Trx 2a36e4b653f7f7da448c5ba6f4ed08fd7a05a39f
View Raw JSON Data
{
  "block": 20595024,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "derasmo",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T23:38:03",
  "trx_id": "2a36e4b653f7f7da448c5ba6f4ed08fd7a05a39f",
  "trx_in_block": 11,
  "virtual_op": 0
}
2018/03/11 23:31:15
authorcoderlovely
permlinkhow-to-use-usdwatch-angularjs-tutorial
voteranomaly
weight100 (1.00%)
Transaction InfoBlock #20594888/Trx 195957f77fd0010fe10ef1f658844dbcc12cfa89
View Raw JSON Data
{
  "block": 20594888,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-use-usdwatch-angularjs-tutorial",
      "voter": "anomaly",
      "weight": 100
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T23:31:15",
  "trx_id": "195957f77fd0010fe10ef1f658844dbcc12cfa89",
  "trx_in_block": 24,
  "virtual_op": 0
}
2018/03/11 22:58:36
allow curation rewardstrue
allow votestrue
authorcoderlovely
extensions[[0,{"beneficiaries":[{"account":"utopian.pay","weight":2500}]}]]
max accepted payout1000000.000 SBD
percent steem dollars10000
permlinkhow-to-use-usdwatch-angularjs-tutorial
Transaction InfoBlock #20594236/Trx 8fa077086022b74be8f21a0822b5a07cf8c4155b
View Raw JSON Data
{
  "block": 20594236,
  "op": [
    "comment_options",
    {
      "allow_curation_rewards": true,
      "allow_votes": true,
      "author": "coderlovely",
      "extensions": [
        [
          0,
          {
            "beneficiaries": [
              {
                "account": "utopian.pay",
                "weight": 2500
              }
            ]
          }
        ]
      ],
      "max_accepted_payout": "1000000.000 SBD",
      "percent_steem_dollars": 10000,
      "permlink": "how-to-use-usdwatch-angularjs-tutorial"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T22:58:36",
  "trx_id": "8fa077086022b74be8f21a0822b5a07cf8c4155b",
  "trx_in_block": 40,
  "virtual_op": 0
}
2018/03/11 22:58:36
authorcoderlovely
body**What Will I Learn?** A. In this tutorial I would like to talk about the $watch function and what you can do with it. B. what is watchFn C.what is watchAction **Requirements** Basic Knowledge of HTML and CSS language . Basic Knowledge of JavaScript language . Has an editor text support HTML and JavaScript . **Difficulty** Basic **$watch(watchFn, watchAction, isDeepWatch)** **watchFn:** Is a string or a function. If you want to observe a $scope property when it changes you have to provide a string, e.g. $watch(‘counter’, …). If you want to observe the return value of a function for changes you have to provide the function, e.g. $watch($scope.getCount, …). **watchAction:** A function to be executed if there are changes in the observed model. The function gets the new value, the old value and the scope as parameters, e.g. function watchAction(newValue, oldValue, scope). **isDeepWatch:** Is a boolean which is set to true, if you watch an array or an object. If you observe an array or object usually you want to know if an element of the array or a property of the object has changed. So if this boolean is set to true the whole array or object is traversed and checked for changes. Beware this could be time consuming if this is a large array or object. **Example for watching a property:** Let’ take the program from 2 ways to set a model value in the view. Each time you click on the button the counter will be increased. I want the button to be disabled when the number reached 10. I can do this by watching the corresponding property: ``` language <div data-ng-controller="CounterCtrl"> <button data-ng-click="increaseCounter()" data-ng-disabled="maxNumberReached">Click to increase counter</button> <div>Counter: {{counter}}</div> </div> ``` ``` language var app = angular.module('myApp', []); app.controller('CounterCtrl', function($scope) { $scope.maxNumberReached = false; $scope.counter = 0; $scope.increaseCounter = function() { $scope.counter++; }; $scope.$watch('counter', function(newValue, oldValue, scope) { if (newValue >= 10) { $scope.maxNumberReached = true; } }); }); ``` **Example for watching a function:** ``` language <div data-ng-controller="CounterCtrl"> <button data-ng-click="increaseCounter()" data-ng-disabled="maxNumberReached">Click to increase counter</button> <div>Counter: {{getCounter()}}</div> </div> ``` ``` language var app = angular.module('myApp', []); app.controller('CounterCtrl', function($scope) { $scope.maxNumberReached = false; $scope.counter = 0; $scope.increaseCounter = function() { $scope.counter++; }; $scope.getCounter = function() { return $scope.counter; }; $scope.$watch($scope.getCounter, function(newValue, oldValue, scope) { if (newValue >= 10) { $scope.maxNumberReached = true; } }); }); ``` **Example for a watcher with watchFn only:** This is a possibility not known by many. There are times when it makes sense to use this version because of performance issues. Imagine you need to watch a large object or array. This can lead to performance problems because each time the page is evaluated AngularJS has to go through the array or object again to check if there is a change. It could be cheaper to manually check the differences in the observed array or object if you exactly know what you want to check. In this case just provide a watchFn function that is called each time the page is evaluated by AngularJS. ``` language <div data-ng-controller="MyCtrl"> <input type="text" data-ng-model="text" data-ng-change="addText()" /> <p>Size of the text array: {{textArrSize}}</p> </div> ``` ``` language var app = angular.module('myApp', []); app.controller('MyCtrl', function($scope) { $scope.text = ''; $scope.textArr = []; $scope.addText = function() { $scope.textArr.push($scope.text); }; $scope.$watch(function() { $scope.textArrSize = $scope.textArr.length; }); }); ``` In the example above each time you type in something in the input field the string is added to an array. The array gets larger and larger. If we had a watcher for this array it could lead to performance issues once the array is too large. So in this case instead of comparing the array for changes only a function is called each time the page is evaluated by AngularJS. The page is evaluated whenever I type in something in the input field. ![](https://i.hizliresim.com/5Dzald.png) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/how-to-use-usdwatch-angularjs-tutorial">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":460078,"name":"angular.js","full_name":"angular/angular.js","html_url":"https://github.com/angular/angular.js","fork":false,"owner":{"login":"angular"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio"]}
parent author
parent permlinkutopian-io
permlinkhow-to-use-usdwatch-angularjs-tutorial
titleHow to use $watch (angularjs tutorial)
Transaction InfoBlock #20594236/Trx 8fa077086022b74be8f21a0822b5a07cf8c4155b
View Raw JSON Data
{
  "block": 20594236,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\n\nA. In this tutorial I would like to talk about the $watch function and what you can do with it.\nB. what is watchFn\nC.what is watchAction\n\n**Requirements**\n\nBasic Knowledge of HTML and CSS language .\nBasic Knowledge of JavaScript language .\nHas an editor text support HTML and JavaScript .\n\n**Difficulty**\nBasic\n\n**$watch(watchFn, watchAction, isDeepWatch)**\n\n**watchFn:**\n\nIs a string or a function. If you want to observe a $scope property when it changes you have to provide a string, e.g. $watch(‘counter’, …). If you want to observe the return value of a function for changes you have to provide the function, e.g. $watch($scope.getCount, …).\n\n**watchAction:**\n\nA function to be executed if there are changes in the observed model. The function gets the new value, the old value and the scope as parameters, e.g. function watchAction(newValue, oldValue, scope).\n\n**isDeepWatch:**\n\nIs a boolean which is set to true, if you watch an array or an object. If you observe an array or object usually you want to know if an element of the array or a property of the object has changed. So if this boolean is set to true the whole array or object is traversed and checked for changes. Beware this could be time consuming if this is a large array or object.\n\n**Example for watching a property:**\n\nLet’ take the program from 2 ways to set a model value in the view. Each time you click on the button the counter will be increased. I want the button to be disabled when the number reached 10. I can do this by watching the corresponding property:\n\n``` language\n<div data-ng-controller=\"CounterCtrl\">\n    <button data-ng-click=\"increaseCounter()\" data-ng-disabled=\"maxNumberReached\">Click to increase counter</button>\n    <div>Counter: {{counter}}</div>\n</div>\n```\n``` language\nvar app = angular.module('myApp', []);\napp.controller('CounterCtrl', function($scope) {\n    $scope.maxNumberReached = false;\n    $scope.counter = 0;\n    $scope.increaseCounter = function() {\n        $scope.counter++;\n    };\n    $scope.$watch('counter', function(newValue, oldValue, scope) {\n        if (newValue >= 10) {\n            $scope.maxNumberReached = true;\n        }\n    });\n});\n```\n**Example for watching a function:**\n\n``` language\n<div data-ng-controller=\"CounterCtrl\">\n    <button data-ng-click=\"increaseCounter()\" data-ng-disabled=\"maxNumberReached\">Click to increase counter</button>\n    <div>Counter: {{getCounter()}}</div>\n</div>\n```\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('CounterCtrl', function($scope) {\n    $scope.maxNumberReached = false;\n    $scope.counter = 0;\n    $scope.increaseCounter = function() {\n        $scope.counter++;\n    };\n    $scope.getCounter = function() {\n        return $scope.counter;\n    };\n    $scope.$watch($scope.getCounter, function(newValue, oldValue, scope) {\n        if (newValue >= 10) {\n            $scope.maxNumberReached = true;\n        }\n    });\n});\n```\n\n**Example for a watcher with watchFn only:**\nThis is a possibility not known by many. There are times when it makes sense to use this version because of performance issues.\n\nImagine you need to watch a large object or array. This can lead to performance problems because each time the page is evaluated AngularJS has to go through the array or object again to check if there is a change. It could be cheaper to manually check the differences in the observed array or object if you exactly know what you want to check.\n\nIn this case just provide a watchFn function that is called each time the page is evaluated by AngularJS.\n\n``` language\n<div data-ng-controller=\"MyCtrl\">\n    <input type=\"text\" data-ng-model=\"text\" data-ng-change=\"addText()\" />\n    <p>Size of the text array: {{textArrSize}}</p>\n</div>\n```\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('MyCtrl', function($scope) {\n    $scope.text = '';\n    $scope.textArr = [];\n    $scope.addText = function() {\n        $scope.textArr.push($scope.text);\n    };\n    $scope.$watch(function() {\n        $scope.textArrSize = $scope.textArr.length;\n    });\n});\n```\n\nIn the example above each time you type in something in the input field the string is added to an array. The array gets larger and larger. If we had a watcher for this array it could lead to performance issues once the array is too large. So in this case instead of comparing the array for changes only a function is called each time the page is evaluated by AngularJS. The page is evaluated whenever I type in something in the input field.\n\n![](https://i.hizliresim.com/5Dzald.png)\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/how-to-use-usdwatch-angularjs-tutorial\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":460078,\"name\":\"angular.js\",\"full_name\":\"angular/angular.js\",\"html_url\":\"https://github.com/angular/angular.js\",\"fork\":false,\"owner\":{\"login\":\"angular\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\"]}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "how-to-use-usdwatch-angularjs-tutorial",
      "title": "How to use $watch (angularjs tutorial)"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T22:58:36",
  "trx_id": "8fa077086022b74be8f21a0822b5a07cf8c4155b",
  "trx_in_block": 40,
  "virtual_op": 0
}
2018/03/11 22:11:36
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
voteraafeng
weight1500 (15.00%)
Transaction InfoBlock #20593297/Trx 5584a990992b320c308a2e39f1b20b02003c7737
View Raw JSON Data
{
  "block": 20593297,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "aafeng",
      "weight": 1500
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T22:11:36",
  "trx_id": "5584a990992b320c308a2e39f1b20b02003c7737",
  "trx_in_block": 42,
  "virtual_op": 0
}
2018/03/11 22:10:51
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
votersteemnova
weight600 (6.00%)
Transaction InfoBlock #20593282/Trx 5c336fc77096f23a02b6b2d8c83c0974ebedc675
View Raw JSON Data
{
  "block": 20593282,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "steemnova",
      "weight": 600
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T22:10:51",
  "trx_id": "5c336fc77096f23a02b6b2d8c83c0974ebedc675",
  "trx_in_block": 28,
  "virtual_op": 0
}
2018/03/11 22:10:45
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
votermys
weight600 (6.00%)
Transaction InfoBlock #20593280/Trx 387916354f185edbb9513847d9862da7e9860722
View Raw JSON Data
{
  "block": 20593280,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "mys",
      "weight": 600
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T22:10:45",
  "trx_id": "387916354f185edbb9513847d9862da7e9860722",
  "trx_in_block": 12,
  "virtual_op": 0
}
2018/03/11 22:10:24
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
votercifer
weight8000 (80.00%)
Transaction InfoBlock #20593273/Trx aee67781816f6db71d16978b73e1f2cc9075d053
View Raw JSON Data
{
  "block": 20593273,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "cifer",
      "weight": 8000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T22:10:24",
  "trx_id": "aee67781816f6db71d16978b73e1f2cc9075d053",
  "trx_in_block": 12,
  "virtual_op": 0
}
2018/03/11 22:09:33
authorportugalcoin
bodyThank you for the contribution. It has been approved. You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
json metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
parent authorcoderlovely
parent permlinkhow-to-repeat-html-elements-in-angularjs
permlinkre-coderlovely-how-to-repeat-html-elements-in-angularjs-20180311t220922246z
title
Transaction InfoBlock #20593256/Trx a97ceaa48684afa5698e466927aab14b181fac05
View Raw JSON Data
{
  "block": 20593256,
  "op": [
    "comment",
    {
      "author": "portugalcoin",
      "body": "Thank you for the contribution. It has been approved.\n\nYou can contact us on [Discord](https://discord.gg/uTyJkNm).\n**[[utopian-moderator]](https://utopian.io/moderators)**",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"utopian\",\"app\":\"utopian/1.0.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "how-to-repeat-html-elements-in-angularjs",
      "permlink": "re-coderlovely-how-to-repeat-html-elements-in-angularjs-20180311t220922246z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T22:09:33",
  "trx_id": "a97ceaa48684afa5698e466927aab14b181fac05",
  "trx_in_block": 7,
  "virtual_op": 0
}
2018/03/11 22:09:15
authorcoderlovely
body**What Will I Learn?** A.How to repeat HTML elements in AngularJS B.We want to display all tracks with the duration as a bulleted list C.Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list **Requirements** Basic Knowledge of HTML and CSS language . Basic Knowledge of JavaScript language . Has an editor text support HTML and JavaScript . **Difficulty** Basic In this tutorial I would like to show you how to repeat HTML elements in AngularJs. So let’s assume we have a list of album tracks. We want to display all tracks with the duration as a bulleted list. Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list: Coldplay 1. Paradise 4:21 (first track) 2. Princes of China 3:35 (middle track) 3. The Scientist 4:26 (middle track) 4. Atlas 3:22 (last track) **Here’s the source code:** ``` language <!DOCTYPE html> <html data-ng-app="myApp"> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> <ul data-ng-controller="AlbumCtrl"> <li data-ng-repeat="track in tracks"> {{$index + 1}}. {{track.name}} {{track.duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track) </li> </ul> </body> </html> ``` ``` language var app = angular.module('myApp', []); app.controller('AlbumCtrl', function($scope) { $scope.tracks = [ {name:'Paradise', duration:'4:21'}, {name:'Princess of China', duration:'3:35'}, {name:'The Scientist', duration:'4:26'}, {name:'Atlas', duration:'3:22'} ]; }); ``` As you can see you can use the data-ng-repeat attribute directive to loop over a collection in the model (tracks) and repeat the < li > element. Inside the loop you can use implicit properties llike $index, $first, $middle and $last which give you the current loop index (starts at 0) and booleans if the element is the first, in the middle or the last in the list respectively. The cool thing is that you not only can loop over a list but also the key-value pairs in an object. So let’s say the album tracks are stored in a JavaScript object: ``` language <h3>Coldplay</h3> <ul data-ng-controller="AlbumCtrl"> <li data-ng-repeat="(name, duration) in tracks"> {{$index + 1}}. {{name}} {{duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track) </li> </ul> ``` ``` language var app = angular.module('myApp', []); app.controller('AlbumCtrl', function($scope) { $scope.tracks = { 'Paradise' : '4:21', 'Princess of China' : '3:35', 'The Scientist' : '4:26', 'Atlas' : '3:22' } }); ``` - As you can see tracks is now a JavaScript object/dictionary. - The notation at data-ng-repeat changed to (name, duration) which represent a key-value pair in tracks. - The downside is that the order of the key-value pairs is not kept as appearing in tracks. AngularJs automatically sorts the keys alphabetically. ![](https://i.hizliresim.com/Md4pm6.png) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/how-to-repeat-html-elements-in-angularjs">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":460078,"name":"angular.js","full_name":"angular/angular.js","html_url":"https://github.com/angular/angular.js","fork":false,"owner":{"login":"angular"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio"],"moderator":{"account":"portugalcoin","time":"2018-03-11T22:09:13.824Z","reviewed":true,"pending":false,"flagged":false},"questions":[{"question":"Is the project description formal?","answers":[{"value":"Yes it’s straight to the point","selected":false,"score":10},{"value":"Need more description ","selected":true,"score":5},{"value":"Not too descriptive","selected":false,"score":0}],"selected":1},{"question":"Is the language / grammar correct?","answers":[{"value":"Yes","selected":true,"score":20},{"value":"A few mistakes","selected":false,"score":10},{"value":"It's pretty bad","selected":false,"score":0}],"selected":0},{"question":"Was the template followed?","answers":[{"value":"Yes","selected":false,"score":10},{"value":"Partially","selected":true,"score":5},{"value":"No","selected":false,"score":0}],"selected":1},{"question":"Is there information about the additional frameworks?","answers":[{"value":"Yes, everything is explained","selected":false,"score":5},{"value":"Yes, but not enough","selected":true,"score":3},{"value":"No details at all","selected":false,"score":0}],"selected":1},{"question":"Is there code in the tutorial?","answers":[{"value":"Yes, and it’s well explained","selected":true,"score":5},{"value":"Yes, but no explanation","selected":false,"score":3},{"value":"No","selected":false,"score":0}],"selected":0},{"question":"Is the tutorial explains technical aspects well enough?","answers":[{"value":"Yes, it teaches how and why about technical aspects","selected":true,"score":5},{"value":"Yes, but it’s not good/enough","selected":false,"score":3},{"value":"No, it explains poorly","selected":false,"score":0}],"selected":0},{"question":"Is the tutorial general and dense enough?","answers":[{"value":"Yes, it’s general and dense","selected":false,"score":5},{"value":"Kinda, it might be more generalized","selected":true,"score":3},{"value":"No, it’s sliced unnecessarily to keep part number high","selected":false,"score":0}],"selected":1},{"question":"Is there an outline for the tutorial content at the beginning of the post","answers":[{"value":"Yes, there is a well prepared outline in “What will I learn?” or another outline section","selected":false,"score":5},{"value":"Yes, but there is no proper listing for every step of the tutorial or it’s not detailed enough","selected":true,"score":3},{"value":"No, there is no outline for the steps.","selected":false,"score":0}],"selected":1},{"question":"Is the visual content of good quality?","answers":[{"value":"Yes","selected":true,"score":5},{"value":"Yes, but bad quality","selected":false,"score":3},{"value":"No","selected":false,"score":0}],"selected":0},{"question":"Is this a tutorial series?","answers":[{"value":"Yes","selected":false,"score":5},{"value":"Yes, but first part","selected":false,"score":3},{"value":"No","selected":true,"score":0}],"selected":2},{"question":"Is the tutorial post structured?","answers":[{"value":"Yes","selected":true,"score":5},{"value":"Not so good","selected":false,"score":3},{"value":"No","selected":false,"score":0}],"selected":0}],"score":51}
parent author
parent permlinkutopian-io
permlinkhow-to-repeat-html-elements-in-angularjs
titleHow to repeat HTML elements in AngularJS
Transaction InfoBlock #20593250/Trx 8dd5055b440d14e48aad51f3129727509cf041bc
View Raw JSON Data
{
  "block": 20593250,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\n\nA.How to repeat HTML elements in AngularJS\nB.We want to display all tracks with the duration as a bulleted list\nC.Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list\n\n**Requirements**\n\nBasic Knowledge of HTML and CSS language .\nBasic Knowledge of JavaScript language .\nHas an editor text support HTML and JavaScript .\n\n**Difficulty**\nBasic\n\nIn this tutorial I would like to show you how to repeat HTML elements in AngularJs. So let’s assume we have a list of album tracks. We want to display all tracks with the duration as a bulleted list. Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list:\n\nColdplay\n\n1. Paradise 4:21 (first track)\n2. Princes of China 3:35 (middle track)\n3. The Scientist 4:26 (middle track)\n4. Atlas 3:22 (last track)\n\n**Here’s the source code:**\n\n``` language\n<!DOCTYPE html>\n<html data-ng-app=\"myApp\">\n  <head>\n    <script type=\"text/javascript\" src=\"angular.min.js\"></script>\n    <script type=\"text/javascript\" src=\"app.js\"></script>\n  </head>\n  <body>\n    <ul data-ng-controller=\"AlbumCtrl\">\n      <li data-ng-repeat=\"track in tracks\">\n        {{$index + 1}}. {{track.name}} {{track.duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track)\n      </li>\n    </ul>\n  </body>\n</html>\n\n```\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('AlbumCtrl', function($scope) {\n    $scope.tracks = [\n        {name:'Paradise', duration:'4:21'},\n        {name:'Princess of China', duration:'3:35'},\n        {name:'The Scientist', duration:'4:26'},\n        {name:'Atlas', duration:'3:22'}\n    ];\n});\n```\nAs you can see you can use the data-ng-repeat attribute directive to loop over a collection in the model (tracks) and repeat the < li > element.\n\nInside the loop you can use implicit properties llike $index, $first, $middle and $last which give you the current loop index (starts at 0) and booleans if the element is the first, in the middle or the last in the list respectively.\n\nThe cool thing is that you not only can loop over a list but also the key-value pairs in an object. So let’s say the album tracks are stored in a JavaScript object:\n\n``` language\n<h3>Coldplay</h3>\n<ul data-ng-controller=\"AlbumCtrl\">\n    <li data-ng-repeat=\"(name, duration) in tracks\">\n        {{$index + 1}}. {{name}} {{duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track)\n    </li>\n</ul>\n```\n``` language\nvar app = angular.module('myApp', []);\napp.controller('AlbumCtrl', function($scope) {\n    $scope.tracks = {\n        'Paradise' : '4:21',\n        'Princess of China' : '3:35',\n        'The Scientist' : '4:26',\n        'Atlas' : '3:22'\n    }\n});\n```\n- As you can see tracks is now a JavaScript object/dictionary.\n- The notation at data-ng-repeat changed to (name, duration) which represent a key-value pair in \n   tracks.\n- The downside is that the order of the key-value pairs is not kept as appearing in tracks. AngularJs automatically sorts the keys alphabetically.\n\n![](https://i.hizliresim.com/Md4pm6.png)\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/how-to-repeat-html-elements-in-angularjs\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":460078,\"name\":\"angular.js\",\"full_name\":\"angular/angular.js\",\"html_url\":\"https://github.com/angular/angular.js\",\"fork\":false,\"owner\":{\"login\":\"angular\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\"],\"moderator\":{\"account\":\"portugalcoin\",\"time\":\"2018-03-11T22:09:13.824Z\",\"reviewed\":true,\"pending\":false,\"flagged\":false},\"questions\":[{\"question\":\"Is the project description formal?\",\"answers\":[{\"value\":\"Yes it’s straight to the point\",\"selected\":false,\"score\":10},{\"value\":\"Need more description \",\"selected\":true,\"score\":5},{\"value\":\"Not too descriptive\",\"selected\":false,\"score\":0}],\"selected\":1},{\"question\":\"Is the language / grammar correct?\",\"answers\":[{\"value\":\"Yes\",\"selected\":true,\"score\":20},{\"value\":\"A few mistakes\",\"selected\":false,\"score\":10},{\"value\":\"It's pretty bad\",\"selected\":false,\"score\":0}],\"selected\":0},{\"question\":\"Was the template followed?\",\"answers\":[{\"value\":\"Yes\",\"selected\":false,\"score\":10},{\"value\":\"Partially\",\"selected\":true,\"score\":5},{\"value\":\"No\",\"selected\":false,\"score\":0}],\"selected\":1},{\"question\":\"Is there information about the additional frameworks?\",\"answers\":[{\"value\":\"Yes, everything is explained\",\"selected\":false,\"score\":5},{\"value\":\"Yes, but not enough\",\"selected\":true,\"score\":3},{\"value\":\"No details at all\",\"selected\":false,\"score\":0}],\"selected\":1},{\"question\":\"Is there code in the tutorial?\",\"answers\":[{\"value\":\"Yes, and it’s well explained\",\"selected\":true,\"score\":5},{\"value\":\"Yes, but no explanation\",\"selected\":false,\"score\":3},{\"value\":\"No\",\"selected\":false,\"score\":0}],\"selected\":0},{\"question\":\"Is the tutorial explains technical aspects well enough?\",\"answers\":[{\"value\":\"Yes, it teaches how and why about technical aspects\",\"selected\":true,\"score\":5},{\"value\":\"Yes, but it’s not good/enough\",\"selected\":false,\"score\":3},{\"value\":\"No, it explains poorly\",\"selected\":false,\"score\":0}],\"selected\":0},{\"question\":\"Is the tutorial general and dense enough?\",\"answers\":[{\"value\":\"Yes, it’s general and dense\",\"selected\":false,\"score\":5},{\"value\":\"Kinda, it might be more generalized\",\"selected\":true,\"score\":3},{\"value\":\"No, it’s sliced unnecessarily to keep part number high\",\"selected\":false,\"score\":0}],\"selected\":1},{\"question\":\"Is there an outline for the tutorial content at the beginning of the post\",\"answers\":[{\"value\":\"Yes, there is a well prepared outline in “What will I learn?” or another outline section\",\"selected\":false,\"score\":5},{\"value\":\"Yes, but there is no proper listing for every step of the tutorial or it’s not detailed enough\",\"selected\":true,\"score\":3},{\"value\":\"No, there is no outline for the steps.\",\"selected\":false,\"score\":0}],\"selected\":1},{\"question\":\"Is the visual content of good quality?\",\"answers\":[{\"value\":\"Yes\",\"selected\":true,\"score\":5},{\"value\":\"Yes, but bad quality\",\"selected\":false,\"score\":3},{\"value\":\"No\",\"selected\":false,\"score\":0}],\"selected\":0},{\"question\":\"Is this a tutorial series?\",\"answers\":[{\"value\":\"Yes\",\"selected\":false,\"score\":5},{\"value\":\"Yes, but first part\",\"selected\":false,\"score\":3},{\"value\":\"No\",\"selected\":true,\"score\":0}],\"selected\":2},{\"question\":\"Is the tutorial post structured?\",\"answers\":[{\"value\":\"Yes\",\"selected\":true,\"score\":5},{\"value\":\"Not so good\",\"selected\":false,\"score\":3},{\"value\":\"No\",\"selected\":false,\"score\":0}],\"selected\":0}],\"score\":51}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "title": "How to repeat HTML elements in AngularJS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T22:09:15",
  "trx_id": "8dd5055b440d14e48aad51f3129727509cf041bc",
  "trx_in_block": 11,
  "virtual_op": 0
}
coderlovelyreceived 0.014 SBD, 0.008 SP author reward for @coderlovely / methods-of-creating-a-web-part-page
2018/03/11 20:30:39
authorcoderlovely
permlinkmethods-of-creating-a-web-part-page
sbd payout0.014 SBD
steem payout0.000 STEEM
vesting payout12.251313 VESTS
Transaction InfoBlock #20591279/Virtual Operation #5
View Raw JSON Data
{
  "block": 20591279,
  "op": [
    "author_reward",
    {
      "author": "coderlovely",
      "permlink": "methods-of-creating-a-web-part-page",
      "sbd_payout": "0.014 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "12.251313 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T20:30:39",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 5
}
utopian.payreceived 0.004 SP benefactor reward from @coderlovely
2018/03/11 20:30:39
authorcoderlovely
benefactorutopian.pay
permlinkmethods-of-creating-a-web-part-page
sbd payout0.000 SBD
steem payout0.000 STEEM
vesting payout6.125656 VESTS
Transaction InfoBlock #20591279/Virtual Operation #4
View Raw JSON Data
{
  "block": 20591279,
  "op": [
    "comment_benefactor_reward",
    {
      "author": "coderlovely",
      "benefactor": "utopian.pay",
      "permlink": "methods-of-creating-a-web-part-page",
      "sbd_payout": "0.000 SBD",
      "steem_payout": "0.000 STEEM",
      "vesting_payout": "6.125656 VESTS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T20:30:39",
  "trx_id": "0000000000000000000000000000000000000000",
  "trx_in_block": 4294967295,
  "virtual_op": 4
}
2018/03/11 18:06:36
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
voterreyha
weight2500 (25.00%)
Transaction InfoBlock #20588409/Trx 91afbbeec16453018da5c96bf4778131b72bcd5b
View Raw JSON Data
{
  "block": 20588409,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "reyha",
      "weight": 2500
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T18:06:36",
  "trx_id": "91afbbeec16453018da5c96bf4778131b72bcd5b",
  "trx_in_block": 3,
  "virtual_op": 0
}
2018/03/11 16:01:24
authorcoderlovely
permlinkhow-to-repeat-html-elements-in-angularjs
voternafestw
weight6500 (65.00%)
Transaction InfoBlock #20585912/Trx f10773be5d05e9eea7f96754f686e66f3760103f
View Raw JSON Data
{
  "block": 20585912,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "voter": "nafestw",
      "weight": 6500
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T16:01:24",
  "trx_id": "f10773be5d05e9eea7f96754f686e66f3760103f",
  "trx_in_block": 27,
  "virtual_op": 0
}
hugewhalesent 0.001 STEEM to @coderlovely- "Promote your post. Send 0.700 SBD / 1.0 STEEM and url in memo and your post will be resteemed with over 8.000+ followers , Min 30+ Upvote , Hugewhale Upvote . Your post will be more popular and you wi..."
2018/03/11 15:06:42
amount0.001 STEEM
fromhugewhale
memoPromote your post. Send 0.700 SBD / 1.0 STEEM and url in memo and your post will be resteemed with over 8.000+ followers , Min 30+ Upvote , Hugewhale Upvote . Your post will be more popular and you will find new friends. Send 0.700 SBD or 1.0 STEEM to @hugewhale ( URL as memo ) Service Active
tocoderlovely
Transaction InfoBlock #20584819/Trx ee4d1a56d904c806cf09cdd712f856babe40e984
View Raw JSON Data
{
  "block": 20584819,
  "op": [
    "transfer",
    {
      "amount": "0.001 STEEM",
      "from": "hugewhale",
      "memo": "Promote your post. Send 0.700 SBD / 1.0 STEEM and url in memo and your post will be resteemed with over 8.000+ followers , Min 30+ Upvote , Hugewhale Upvote . Your post will be more popular and you will find new friends. Send 0.700 SBD or 1.0 STEEM to @hugewhale ( URL as memo ) Service Active ",
      "to": "coderlovely"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T15:06:42",
  "trx_id": "ee4d1a56d904c806cf09cdd712f856babe40e984",
  "trx_in_block": 33,
  "virtual_op": 0
}
2018/03/11 15:03:15
allow curation rewardstrue
allow votestrue
authorcoderlovely
extensions[[0,{"beneficiaries":[{"account":"utopian.pay","weight":2500}]}]]
max accepted payout1000000.000 SBD
percent steem dollars10000
permlinkhow-to-repeat-html-elements-in-angularjs
Transaction InfoBlock #20584750/Trx 2ffecb37113e0efa63899feaf45e0fb1b9d8f092
View Raw JSON Data
{
  "block": 20584750,
  "op": [
    "comment_options",
    {
      "allow_curation_rewards": true,
      "allow_votes": true,
      "author": "coderlovely",
      "extensions": [
        [
          0,
          {
            "beneficiaries": [
              {
                "account": "utopian.pay",
                "weight": 2500
              }
            ]
          }
        ]
      ],
      "max_accepted_payout": "1000000.000 SBD",
      "percent_steem_dollars": 10000,
      "permlink": "how-to-repeat-html-elements-in-angularjs"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T15:03:15",
  "trx_id": "2ffecb37113e0efa63899feaf45e0fb1b9d8f092",
  "trx_in_block": 8,
  "virtual_op": 0
}
2018/03/11 15:03:15
authorcoderlovely
body**What Will I Learn?** A.How to repeat HTML elements in AngularJS B.We want to display all tracks with the duration as a bulleted list C.Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list **Requirements** Basic Knowledge of HTML and CSS language . Basic Knowledge of JavaScript language . Has an editor text support HTML and JavaScript . **Difficulty** Basic In this tutorial I would like to show you how to repeat HTML elements in AngularJs. So let’s assume we have a list of album tracks. We want to display all tracks with the duration as a bulleted list. Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list: Coldplay 1. Paradise 4:21 (first track) 2. Princes of China 3:35 (middle track) 3. The Scientist 4:26 (middle track) 4. Atlas 3:22 (last track) **Here’s the source code:** ``` language <!DOCTYPE html> <html data-ng-app="myApp"> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body> <ul data-ng-controller="AlbumCtrl"> <li data-ng-repeat="track in tracks"> {{$index + 1}}. {{track.name}} {{track.duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track) </li> </ul> </body> </html> ``` ``` language var app = angular.module('myApp', []); app.controller('AlbumCtrl', function($scope) { $scope.tracks = [ {name:'Paradise', duration:'4:21'}, {name:'Princess of China', duration:'3:35'}, {name:'The Scientist', duration:'4:26'}, {name:'Atlas', duration:'3:22'} ]; }); ``` As you can see you can use the data-ng-repeat attribute directive to loop over a collection in the model (tracks) and repeat the < li > element. Inside the loop you can use implicit properties llike $index, $first, $middle and $last which give you the current loop index (starts at 0) and booleans if the element is the first, in the middle or the last in the list respectively. The cool thing is that you not only can loop over a list but also the key-value pairs in an object. So let’s say the album tracks are stored in a JavaScript object: ``` language <h3>Coldplay</h3> <ul data-ng-controller="AlbumCtrl"> <li data-ng-repeat="(name, duration) in tracks"> {{$index + 1}}. {{name}} {{duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track) </li> </ul> ``` ``` language var app = angular.module('myApp', []); app.controller('AlbumCtrl', function($scope) { $scope.tracks = { 'Paradise' : '4:21', 'Princess of China' : '3:35', 'The Scientist' : '4:26', 'Atlas' : '3:22' } }); ``` - As you can see tracks is now a JavaScript object/dictionary. - The notation at data-ng-repeat changed to (name, duration) which represent a key-value pair in tracks. - The downside is that the order of the key-value pairs is not kept as appearing in tracks. AngularJs automatically sorts the keys alphabetically. ![](https://i.hizliresim.com/Md4pm6.png) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/how-to-repeat-html-elements-in-angularjs">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":460078,"name":"angular.js","full_name":"angular/angular.js","html_url":"https://github.com/angular/angular.js","fork":false,"owner":{"login":"angular"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio"]}
parent author
parent permlinkutopian-io
permlinkhow-to-repeat-html-elements-in-angularjs
titleHow to repeat HTML elements in AngularJS
Transaction InfoBlock #20584750/Trx 2ffecb37113e0efa63899feaf45e0fb1b9d8f092
View Raw JSON Data
{
  "block": 20584750,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\n\nA.How to repeat HTML elements in AngularJS\nB.We want to display all tracks with the duration as a bulleted list\nC.Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list\n\n**Requirements**\n\nBasic Knowledge of HTML and CSS language .\nBasic Knowledge of JavaScript language .\nHas an editor text support HTML and JavaScript .\n\n**Difficulty**\nBasic\n\nIn this tutorial I would like to show you how to repeat HTML elements in AngularJs. So let’s assume we have a list of album tracks. We want to display all tracks with the duration as a bulleted list. Moreover we want to display the index and the information if the track is the first, in the middle or the last in the list:\n\nColdplay\n\n1. Paradise 4:21 (first track)\n2. Princes of China 3:35 (middle track)\n3. The Scientist 4:26 (middle track)\n4. Atlas 3:22 (last track)\n\n**Here’s the source code:**\n\n``` language\n<!DOCTYPE html>\n<html data-ng-app=\"myApp\">\n  <head>\n    <script type=\"text/javascript\" src=\"angular.min.js\"></script>\n    <script type=\"text/javascript\" src=\"app.js\"></script>\n  </head>\n  <body>\n    <ul data-ng-controller=\"AlbumCtrl\">\n      <li data-ng-repeat=\"track in tracks\">\n        {{$index + 1}}. {{track.name}} {{track.duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track)\n      </li>\n    </ul>\n  </body>\n</html>\n\n```\n\n``` language\nvar app = angular.module('myApp', []);\napp.controller('AlbumCtrl', function($scope) {\n    $scope.tracks = [\n        {name:'Paradise', duration:'4:21'},\n        {name:'Princess of China', duration:'3:35'},\n        {name:'The Scientist', duration:'4:26'},\n        {name:'Atlas', duration:'3:22'}\n    ];\n});\n```\nAs you can see you can use the data-ng-repeat attribute directive to loop over a collection in the model (tracks) and repeat the < li > element.\n\nInside the loop you can use implicit properties llike $index, $first, $middle and $last which give you the current loop index (starts at 0) and booleans if the element is the first, in the middle or the last in the list respectively.\n\nThe cool thing is that you not only can loop over a list but also the key-value pairs in an object. So let’s say the album tracks are stored in a JavaScript object:\n\n``` language\n<h3>Coldplay</h3>\n<ul data-ng-controller=\"AlbumCtrl\">\n    <li data-ng-repeat=\"(name, duration) in tracks\">\n        {{$index + 1}}. {{name}} {{duration}} ({{$first ? 'first' : $middle ? 'middle' : 'last'}} track)\n    </li>\n</ul>\n```\n``` language\nvar app = angular.module('myApp', []);\napp.controller('AlbumCtrl', function($scope) {\n    $scope.tracks = {\n        'Paradise' : '4:21',\n        'Princess of China' : '3:35',\n        'The Scientist' : '4:26',\n        'Atlas' : '3:22'\n    }\n});\n```\n- As you can see tracks is now a JavaScript object/dictionary.\n- The notation at data-ng-repeat changed to (name, duration) which represent a key-value pair in \n   tracks.\n- The downside is that the order of the key-value pairs is not kept as appearing in tracks. AngularJs automatically sorts the keys alphabetically.\n\n![](https://i.hizliresim.com/Md4pm6.png)\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/how-to-repeat-html-elements-in-angularjs\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":460078,\"name\":\"angular.js\",\"full_name\":\"angular/angular.js\",\"html_url\":\"https://github.com/angular/angular.js\",\"fork\":false,\"owner\":{\"login\":\"angular\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\"]}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "how-to-repeat-html-elements-in-angularjs",
      "title": "How to repeat HTML elements in AngularJS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T15:03:15",
  "trx_id": "2ffecb37113e0efa63899feaf45e0fb1b9d8f092",
  "trx_in_block": 8,
  "virtual_op": 0
}
2018/03/11 12:18:45
authorportugalcoin
bodyYour contribution cannot be approved because it does not follow the [Utopian Rules](https://utopian.io/rules). - Tutorials must be technical instructions that teach non-trivial aspects of an Open Source project. My opinion: - Too trivial. You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
json metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
parent authorcoderlovely
parent permlinkhow-to-write-a-single-page-app-with-different-views-in-angularjs
permlinkre-coderlovely-how-to-write-a-single-page-app-with-different-views-in-angularjs-20180311t121845434z
title
Transaction InfoBlock #20581463/Trx 068894bb721926b787719689ca425480f951eb3c
View Raw JSON Data
{
  "block": 20581463,
  "op": [
    "comment",
    {
      "author": "portugalcoin",
      "body": "Your contribution cannot be approved because it does not follow the [Utopian Rules](https://utopian.io/rules).\n\n- Tutorials must be technical instructions that teach non-trivial aspects of an Open Source project.\n\nMy opinion:\n- Too trivial.\n\nYou can contact us on [Discord](https://discord.gg/uTyJkNm).\n**[[utopian-moderator]](https://utopian.io/moderators)**",
      "json_metadata": "{\"tags\":[\"utopian-io\"],\"community\":\"utopian\",\"app\":\"utopian/1.0.0\"}",
      "parent_author": "coderlovely",
      "parent_permlink": "how-to-write-a-single-page-app-with-different-views-in-angularjs",
      "permlink": "re-coderlovely-how-to-write-a-single-page-app-with-different-views-in-angularjs-20180311t121845434z",
      "title": ""
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T12:18:45",
  "trx_id": "068894bb721926b787719689ca425480f951eb3c",
  "trx_in_block": 38,
  "virtual_op": 0
}
2018/03/11 12:17:30
authorcoderlovely
body**What Will I Learn?** **A**.In this tutorial I would like to talk about how you write a single page app with different views in AngularJS. **B**.Routes with parameter **C**.You can configure it by calling the config function and passing it a function that gets the $routeProvider injected. **Requirements** Basic Knowledge of HTML and CSS language . Basic Knowledge of JavaScript language . Has an editor text support HTML and JavaScript . **Difficulty** Basic **Simple routes** In AngularJS a single page app usually consists of just one index.html. If you want the app to have different pages that you can address via a URL path (e.g. www.yourapp.com/dashboard or www.yourapp.com/settings etc.) you can do this by using and configuring the AngularJS **$routeProvider**. **$routeProvider** is a service that can be injected when you configure the main module: **index.html:** ``` language <html data-ng-app="myApp"> <head> <script src="src/angular.js"></script> <script src="src/controllers.js"></script> </head> <body> <h1>My App</h1> <div data-ng-view></div> </body> </html> ``` **app.js:** ``` language var app = angular.module('myApp', []); app.config(function($routeProvider) { $routeProvider.when('/', { controller: DashboardCtrl, templateUrl: 'dashboard.html' }).when('/settings', { controller: SettingsCtrl, templateUrl: 'settings.html' }).otherwise({ redirectTo: '/' }); }); ``` In the index.html you can see that there is a ng-view (data-ng-view to be HTML5 compatible) directive on a div. This is where the different views come in. The views are HTML files which are loaded into that container. This also means that everything that you want to be appearing across all views must be outside of this container. This can e.g. be a navigation bar. **myApp** is the main module. You can configure it by calling the config function and passing it a function that gets the **$routeProvider** injected. The **$routeProvider** can now be configured with routes (see / and /settings). Each route leads to an HTML file (see templateUrl) and each HTML file is managed by a controller (see controller). The otherwise function tells the **$routeProvider** what to do if the browser URL path does not match any specified URL paths. In this case the **$routeProvider** redirects to /. **Routes with parameter** It is also possible to define routes with parameter(s). Look at the following code line 9: ``` language var app = angular.module('myApp', []); app.config(function($routeProvider) { $routeProvider.when('/', { controller: DashboardCtrl, templateUrl: 'dashboard.html' }).when('/settings', { controller: SettingsCtrl, templateUrl: 'settings.html' }).when('/item/:id', { controller: ItemCtrl, templateUrl: 'item.html' }).otherwise({ redirectTo: '/' }); }); ``` You can see that there is a parameter :id. Parameters in routes start with a leading colon. An example route would be /item/3. The route parameter can be read out in a controller by injecting the **$routeParams** service and reading out the property: ``` language app.controller('ItemCtrl', function($scope, $routeParams) { $scope.id = $routeParams.id; }); ``` $scope.id holds the number 3 when calling something like www.yourapp.com/item/3 in the browser. ![](https://i.hizliresim.com/vj7Qaz.png) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@coderlovely/how-to-write-a-single-page-app-with-different-views-in-angularjs">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
json metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":460078,"name":"angular.js","full_name":"angular/angular.js","html_url":"https://github.com/angular/angular.js","fork":false,"owner":{"login":"angular"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian","utopianio","angularjs"],"moderator":{"account":"portugalcoin","time":"2018-03-11T12:17:30.465Z","flagged":true,"reviewed":false,"pending":false},"questions":[],"score":null}
parent author
parent permlinkutopian-io
permlinkhow-to-write-a-single-page-app-with-different-views-in-angularjs
titleHow to write a single page app with different views in AngularJS
Transaction InfoBlock #20581438/Trx 6aaaac2f3b95a00d1c2627eab49bbae849874761
View Raw JSON Data
{
  "block": 20581438,
  "op": [
    "comment",
    {
      "author": "coderlovely",
      "body": "**What Will I Learn?**\n\n**A**.In this tutorial I would like to talk about how you write a single page app with different views in AngularJS.\n**B**.Routes with parameter\n**C**.You can configure it by calling the config function and passing it a function that gets the $routeProvider injected.\n\n**Requirements**\n\nBasic Knowledge of HTML and CSS language .\nBasic Knowledge of JavaScript language .\nHas an editor text support HTML and JavaScript .\n\n**Difficulty**\nBasic\n\n**Simple routes**\n\nIn AngularJS a single page app usually consists of just one index.html. If you want the app to have different pages that you can address via a URL path (e.g. www.yourapp.com/dashboard or www.yourapp.com/settings etc.) you can do this by using and configuring the AngularJS **$routeProvider**. \n**$routeProvider** is a service that can be injected when you configure the main module:\n\n**index.html:**\n\n``` language\n<html data-ng-app=\"myApp\">\n  <head>\n    <script src=\"src/angular.js\"></script>\n    <script src=\"src/controllers.js\"></script>\n  </head>\n  <body>\n    <h1>My App</h1>\n    <div data-ng-view></div>\n  </body>\n</html>\n```\n\n**app.js:**\n\n``` language\nvar app = angular.module('myApp', []);\napp.config(function($routeProvider) {\n    $routeProvider.when('/', {\n        controller: DashboardCtrl,\n        templateUrl: 'dashboard.html'\n    }).when('/settings', {\n        controller: SettingsCtrl,\n        templateUrl: 'settings.html'\n    }).otherwise({\n        redirectTo: '/'\n    });\n});\n```\n\nIn the index.html you can see that there is a ng-view (data-ng-view to be HTML5 compatible) directive on a div. This is where the different views come in. The views are HTML files which are loaded into that container. This also means that everything that you want to be appearing across all views must be outside of this container. This can e.g. be a navigation bar.\n\n**myApp** is the main module. You can configure it by calling the config function and passing it a function that gets the **$routeProvider** injected. The **$routeProvider** can now be configured with routes (see / and /settings). Each route leads to an HTML file (see templateUrl) and each HTML file is managed by a controller (see controller).\n\nThe otherwise function tells the **$routeProvider** what to do if the browser URL path does not match any specified URL paths. In this case the **$routeProvider** redirects to /.\n\n**Routes with parameter**\n\nIt is also possible to define routes with parameter(s). Look at the following code line 9:\n\n``` language\nvar app = angular.module('myApp', []);\napp.config(function($routeProvider) {\n    $routeProvider.when('/', {\n        controller: DashboardCtrl,\n        templateUrl: 'dashboard.html'\n    }).when('/settings', {\n        controller: SettingsCtrl,\n        templateUrl: 'settings.html'\n    }).when('/item/:id', {\n        controller: ItemCtrl,\n        templateUrl: 'item.html'\n    }).otherwise({\n        redirectTo: '/'\n    });\n});\n```\nYou can see that there is a parameter :id. Parameters in routes start with a leading colon. An example route would be /item/3.\n\nThe route parameter can be read out in a controller by injecting the **$routeParams** service and reading out the property:\n\n``` language\napp.controller('ItemCtrl', function($scope, $routeParams) {\n   $scope.id = $routeParams.id;\n});\n```\n\n$scope.id holds the number 3 when calling something like www.yourapp.com/item/3 in the browser.\n\n![](https://i.hizliresim.com/vj7Qaz.png)\n\n\n\n<br /><hr/><em>Posted on <a href=\"https://utopian.io/utopian-io/@coderlovely/how-to-write-a-single-page-app-with-different-views-in-angularjs\">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>",
      "json_metadata": "{\"community\":\"utopian\",\"app\":\"utopian/1.0.0\",\"format\":\"markdown\",\"repository\":{\"id\":460078,\"name\":\"angular.js\",\"full_name\":\"angular/angular.js\",\"html_url\":\"https://github.com/angular/angular.js\",\"fork\":false,\"owner\":{\"login\":\"angular\"}},\"pullRequests\":[],\"platform\":\"github\",\"type\":\"tutorials\",\"tags\":[\"utopian-io\",\"utopian\",\"utopianio\",\"angularjs\"],\"moderator\":{\"account\":\"portugalcoin\",\"time\":\"2018-03-11T12:17:30.465Z\",\"flagged\":true,\"reviewed\":false,\"pending\":false},\"questions\":[],\"score\":null}",
      "parent_author": "",
      "parent_permlink": "utopian-io",
      "permlink": "how-to-write-a-single-page-app-with-different-views-in-angularjs",
      "title": "How to write a single page app with different views in AngularJS"
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T12:17:30",
  "trx_id": "6aaaac2f3b95a00d1c2627eab49bbae849874761",
  "trx_in_block": 32,
  "virtual_op": 0
}
2018/03/11 12:07:33
authorcoderlovely
permlinkhow-to-write-a-single-page-app-with-different-views-in-angularjs
voteryuliyashe
weight10000 (100.00%)
Transaction InfoBlock #20581240/Trx e5a21f8ead0da73c5eedb2c47e0026ccae00e33b
View Raw JSON Data
{
  "block": 20581240,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-write-a-single-page-app-with-different-views-in-angularjs",
      "voter": "yuliyashe",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T12:07:33",
  "trx_id": "e5a21f8ead0da73c5eedb2c47e0026ccae00e33b",
  "trx_in_block": 48,
  "virtual_op": 0
}
2018/03/11 12:07:33
authorcoderlovely
permlinkhow-to-write-a-single-page-app-with-different-views-in-angularjs
voterstulul
weight10000 (100.00%)
Transaction InfoBlock #20581240/Trx d7ea3ee6dc989e5255eeecffa5a4dd2865444350
View Raw JSON Data
{
  "block": 20581240,
  "op": [
    "vote",
    {
      "author": "coderlovely",
      "permlink": "how-to-write-a-single-page-app-with-different-views-in-angularjs",
      "voter": "stulul",
      "weight": 10000
    }
  ],
  "op_in_trx": 0,
  "timestamp": "2018-03-11T12:07:33",
  "trx_id": "d7ea3ee6dc989e5255eeecffa5a4dd2865444350",
  "trx_in_block": 29,
  "virtual_op": 0
}

Account Metadata

POSTING JSON METADATA
profile{"profile_image":"https://i.hizliresim.com/BLbMy9.jpg","cover_image":"https://i.hizliresim.com/YgEB6l.jpg","location":"ESKİSEHİR"}
JSON METADATA
profile{"profile_image":"https://i.hizliresim.com/BLbMy9.jpg","cover_image":"https://i.hizliresim.com/YgEB6l.jpg","location":"ESKİSEHİR"}
{
  "posting_json_metadata": {
    "profile": {
      "profile_image": "https://i.hizliresim.com/BLbMy9.jpg",
      "cover_image": "https://i.hizliresim.com/YgEB6l.jpg",
      "location": "ESKİSEHİR"
    }
  },
  "json_metadata": {
    "profile": {
      "profile_image": "https://i.hizliresim.com/BLbMy9.jpg",
      "cover_image": "https://i.hizliresim.com/YgEB6l.jpg",
      "location": "ESKİSEHİR"
    }
  }
}

Auth Keys

Owner
Single Signature
Public Keys
STM7WsQbM7iPnqxqxxUmmbnTDi7uomqwY2WnWHP6Q3g63VV7Knr7q1/1
Active
Single Signature
Public Keys
STM55KGDtLYn6LoDTpYHzJP3ntjwqew2VvDCkGcPbDDti5BofkgqJ1/1
Posting
Single Signature
Public Keys
STM5XqMjENbeusT1riittDSQqLxAN4m2EXrnL1xnZEFMXGuAog8cS1/1
App Permissions
Memo
STM8HZvacMZ8Q9DGuYD1cfrWLUfGjPfe8Kin74gpUEStZ6C6GWnya
{
  "owner": {
    "account_auths": [],
    "key_auths": [
      [
        "STM7WsQbM7iPnqxqxxUmmbnTDi7uomqwY2WnWHP6Q3g63VV7Knr7q",
        1
      ]
    ],
    "weight_threshold": 1
  },
  "active": {
    "account_auths": [],
    "key_auths": [
      [
        "STM55KGDtLYn6LoDTpYHzJP3ntjwqew2VvDCkGcPbDDti5BofkgqJ",
        1
      ]
    ],
    "weight_threshold": 1
  },
  "posting": {
    "account_auths": [
      [
        "utopian.app",
        1
      ]
    ],
    "key_auths": [
      [
        "STM5XqMjENbeusT1riittDSQqLxAN4m2EXrnL1xnZEFMXGuAog8cS",
        1
      ]
    ],
    "weight_threshold": 1
  },
  "memo": "STM8HZvacMZ8Q9DGuYD1cfrWLUfGjPfe8Kin74gpUEStZ6C6GWnya"
}

Witness Votes

0 / 30
No active witness votes.
[]