惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
CERT Recently Published Vulnerability Notes
V
Vulnerabilities – Threatpost
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
Schneier on Security
Schneier on Security
T
Threatpost
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
T
Threat Research - Cisco Blogs
罗磊的独立博客
Security Latest
Security Latest
D
Docker
S
Secure Thoughts
博客园 - 聂微东
A
Arctic Wolf
Recorded Future
Recorded Future
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
P
Palo Alto Networks Blog
Project Zero
Project Zero
Blog — PlanetScale
Blog — PlanetScale
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
T
The Blog of Author Tim Ferriss
Latest news
Latest news
AWS News Blog
AWS News Blog
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
The GitHub Blog
The GitHub Blog
Know Your Adversary
Know Your Adversary
Vercel News
Vercel News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
F
Full Disclosure
Martin Fowler
Martin Fowler
T
The Exploit Database - CXSecurity.com
Attack and Defense Labs
Attack and Defense Labs
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
V
V2EX
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
小众软件
小众软件
宝玉的分享
宝玉的分享

博客园 - 瑞雪年

开始使用 Xamarin.Forms.Platform.Avalonia Git仓库迁移命令 .NET Core也可以使用MongoDB了 ng2-timesheet, 一个timesheet.js的angular2复制版 Angular 2 + Electron 开发web和桌面应用 Xamarin.Forms.Platform.Perspex, Xamarin Forms 的 Perspex(号称下一代WPF) 实现 Visual Studio Xamarin编译Android项目出错的解决办法 NativeScript 也能开发桌面应用 (nativescript-dotnet-runtime) iOS集成丁香园DXY OAuth 登陆 swift代码示例 WinObjC?这是什么鬼? 如何禁用Marlin温度保护 React Native也正式发布了 微信企业号 用javascript写Android和iOS naitve应用,实在炫酷。 CoreCLR 在 Linux 下编译成功 Swift 对比学习 (二) Swift 对比学习 (一) 重量级Orchard模块发布 - 模块生成工具RaisingStudio.ModuleGenerator coding.net
Salesforce + AngularJS + Bootstrap
瑞雪年 · 2016-01-30 · via 博客园 - 瑞雪年

也可以分成三步:

1. 添加css和js引用:

    <apex:stylesheet value="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></apex:stylesheet>
    <script src="https://code.angularjs.org/1.4.9/angular.min.js"></script>
    <script src="{!$Resource.forcetk4ng}"></script>   

2. 添加html代码:

        <div ng-app="ngapp">
            <div ng-controller="positionCtl">
                <button ng-click="getPositions()" class='btn btn-primary'>Retrieve Data</button>
                <table class='table table-bordered table-hover  table-striped '>
                    <thead>
                        <tr>
                            <td>Id</td>
                            <td>Name</td>
                            <td>IsAllow</td>                            
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="record in position.records">
                            <td>{{record.Id}}</td>
                            <td>{{record.Name}}</td>
                            <td>{{record.IsAllow__c}}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

3. 添加js代码,使用forcetk4ng获取数据:

        angular.module('ngapp', ['forcetk4ng'])
            .controller('positionCtl', function($scope, force){
                force.setAccessToken('{!$Api.Session_ID}');
                $scope.position = {};    
                $scope.getPositions = function(){
                    var soql = "select Id, Name, IsAllow__c from PositionTest__c";
                    force.query(soql)
                    .then(
                        function(records){
                            $scope.position.records = records;
                        },
                        function(event){
                            console.log(event);
                        }
                    );
                };        
                $scope.getPositions();
            });

示例: https://c.ap1.visual.force.com/apex/TestApexPage (此地址为个人测试地址)

注:可以给apex:page添加一些属性,去掉Salesforce样式和菜单,就和普通html页面一样了。

<apex:page standardStylesheets="false" showHeader="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">